fusion of procedures in the package and calling with common proc?

Hello

I wrote similar procedures... and I'm calling each procedure separately and transmitting his values...

something like that
 

   begin 
   mov_tbl1(1234); 
   end 

then again similarly for 

   begin 
   mov_tbl2(1234); 
   end;    
   
My question is how to merge these two procedures in one package and call them with a common procedure and pass the value (var_id) once for procedures?
 
create or replace procedure mov_tbl1 ( var_id number)  is 
         
         cursor tbl1_cur as 
         select  src.col1, 
                 src.col2, 
          from abc_tbl1 tbl1, 
               abc_tbl2 tbl2 
          where tbl1.no = var_id  -- this is variable i m trying to make it as a paramter in common proc 
                tbl1.id = tbl.id 
               -- the record variable declaration is implicit in FOR LOOP 
      begin 
            for  tbl1_cur_rec  in tbl1_cur 
            loop 
              begin 
                insert into tgt.tabl1(col1,col2) 
                            values (tbl1_cur_rec.col1, 
                                tbl1_cur_reccol2, 
                        ); 
                        exception 
                     when others then 
                       null; 
              end; 
            end loop; 
      end; 


create or replace procedure mov_tbl2(var_id number) is 
    
       cursor cur_tbl2 
         select col3,col4, col5 
           ...... 
         from abc_tbl1 tbl1, 
               abc_tbl2 tbl2, 
               abc_tbl3 tbl3 
        where   tbl1.no = var_id and   --this is variable i m trying to make it as a paramter in common proc 
                tbl1.id = tbl.id and 
                tbl2.dept = tbl3.dept 
          begin 
              for ... 
                loop ... 
                  insert into ... 
                     values.... 
         .... 
          end; 
  
I m bit confused, if you want to use the parameter or parameter... .i am beginner in writing packages... :))
Ideas or examples is greatly appreciated! Thank you very much!!

Check if all parameters have been assigned to certain values.

And call the procedure that is packaged with the following syntax.

Begin
.(parameter_value);
end;

i.e.
Begin
TEST_PACK.COMMON_PROC(1234);
End;

Can you post the code here so that we can have a look at what goes wrong.

Here is a test package I ran

PRAZY@11gR1> create or replace package test_pack as
  2  procedure common_proc(var_id number);
  3  end;
  4  /

Package created.

Elapsed: 00:00:00.00
PRAZY@11gR1> create or replace package body test_pack as
  2  procedure private_proc1(var_id number) as
  3  begin
  4  dbms_output.put_line('FROM PROC1 :'||var_id);
  5  end;
  6
  7  procedure private_proc2(var_id number) as
  8  begin
  9  dbms_output.put_line('FROM PROC2 :'||var_id);
 10  end;
 11
 12  procedure common_proc(var_id number) as
 13  begin
 14  private_proc1(var_id);
 15  private_proc2(var_id);
 16  end;
 17
 18  end;
 19  /

Package body created.

Elapsed: 00:00:00.04
PRAZY@11gR1> begin
  2  test_pack.common_proc(100);
  3  end;
  4  /
FROM PROC1 :100
FROM PROC2 :100

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01

Kind regards
Prazy

Tags: Database

Similar Questions

Maybe you are looking for

  • The Windows Developer Preview expires in 2013/115?

    my windows 8 dev. Prev.  expire in 2013/115 my is that beta? normally it will be completed in March .photo of cabin of the image:http://desmond.imageshack.us/Himg23/scaled.php?server=23&filename=64074771.png&res=medium

  • I am trying to print a directory listing

    I added to my Windows XP Printdir.bat file; However I am still not able to print a directory listing.  When I right click on the folder, I get the following message: Cannot find the file c:\Docume~1\***\Locals~1\TempListing.txt He wants to go in this

  • How can I set up SCAN TO EMAIL using GMAIL for 3520e Deskjet AIO?

    I have the gmail warning system installed for to send the links to open a Gmail composition window. I thought that would be enough. I watched the default parameters of the program, but that doesn't seem to apply, probably because I don't have an emai

  • Windows 7 is installed, now missing "Mass storage controller" driver (Code 28)

    I installed Windows 7 (32 bit) and Bishop of device under the heading "Other devices" Windows could not find the device driver for the "mass storage controller".  My motherboard is an Asus P5AD2 - E Premium. Device type: other devicesManufacturer: un

  • Compare documents crashes

    Hi people,I do a review of the book and need to compare the old (April 2015) and new files (November 2015) PDF. I get a crash every time. I tried to isolate very small segments (two pages) of the files and compare them. Still crashes.Here is the vers