Execution of a procedure in a package

Hello

How to run a procedure in a package? Here is the package

CREATE OR REPLACE PACKAGE BODY POPULATE_GLTD_TABLES
IS
-LOCAL VARIABLES
VARCHAR2 (10) val1;
-Create work items:
v_job1_str VARCHAR2 (4000);
v_job1 XXMCK. XXMCK_JOB_OT;

PROCEDURE populate_gltd_tabs1
IS
BEGIN
dbms_output.put_line ('Get_status = > v_job1: ');
val1: = F_CHECK_GLTD_RECORD_EXISTS ('MCK_GLTD_1');
IF Val1! s ="THEN
--
-Understand the value of details message - TRUE if yes and FALSE if no
--
xxmck.mck_write_log_msg.set_msg_tail (true);
--
xxmck.mck_write_log_msg.purge('GLTD-TASK1');
--
-together framework will define the source so that inserts data into the table of output cont
--
xxmck.mck_write_log_msg.set_Context(v_parent_program,v_prog_desc,'GLTD-TASK1');
--
xxmck.mck_write_log_msg.log (v_parent_program, "enter in LOAD_GLTD_TABLES.populate_gltd_tabs1', 'prg', 'GLTD-TASK1', 1");
--
xxmck.mck_write_log_msg.log_tail (v_parent_program, "enter in LOAD_GLTD_TABLES.populate_gltd_tabs1', 'prg', 'GLTD-TASK1'");
--

v_job1_str: = ' XXCOGNOS. LOAD_GLTD_TABLES.populate_gltd_tabs1;';

v_job1: = NEW XXMCK. XXMCK_JOB_OT ('GLTD-TASK1', v_job1_str, ' test of substantive work: LOAD_GLTD_TABLES.populate_gltd_tabs1 ', INTERVAL ' 60' SECOND ');
v_job1. PRINT(); -Display of the basic information about the work
v_job1. SUBMIT(); -Propose in the background
v_job1. WAIT();
v_job1. PRINT();
v_job1.get_Status (v_code, v_message);
dbms_output.put_line ('Get_status = > v_job1: ' | v_code |) ':' || v_message);

-SELECT DECODE (cont_exit, 'cont', 'cont', 'err', 'err', 'cont') IN v_result of MCK_LOG_CONT_EXIT_CHK WHERE source = 'GLTD-TASK1;

-IF v_result = "err" THEN
-raise_application_error ("-20000, ' program Aborted");
-END IF;
END IF;
EXCEPTION
WHEN OTHER THEN NULL;
END populate_gltd_tabs1;

PROCEDURE mainproc
IS
BEGIN
populate_gltd_tabs1; -CALL to FILL in mck_gltd_1 TABLE
--
-Mailing
--
xxmck.mck_write_log_msg.send_mail (p_source_prg = > v_parent_program)
, p_source = > 'GLTD-TASK1.
, p_msg_type = > 'prg '.
, p_from = > '[email protected] '.
, p_to = > '[email protected] '.
, p_server = > 'mailhub.mckinsey.com '.
);
EXCEPTION
WHEN OTHER THEN NULL;
END mainproc;

END POPULATE_GLTD_TABLES;
/





And here's my anonymous block to run above package

BEGIN
POPULATE_MCK_GLTDFILE.mainproc;
EXCEPTION - begin exception handler
WHEN OTHER THEN NULL;
END;


I am trying to run above the code into a toad. But I get the error message like: identifier 'POPULATE_MCK_GLTDFILE.mainproc' must be declared.
There is no parameter to pass.
The package is compiled successfully.
I think this must be the easiest question anyone I can ask, but I can't understand the solution.

Help, please
Aditya

Try this (you are using the wromg package name)

BEGIN
POPULATE_GLTD_TABLES.mainproc;
EXCEPTION
WHEN OTHER THEN NULL;
END;

Published by: Saran on January 13, 2012 01:38

Published by: Saran on January 13, 2012 01:38

Published by: Saran on January 13, 2012 01:40

Tags: Database

Similar Questions

  • grant user privileges for the execution of a procedure in a package

    Hi all

    My need is to grant privileges to User1 to run only a single procedure proc1 in package1.
    It is possible at all?
    Do I need to grant more privileges if procedure1 calls procedure2?

    Hello

    Marco wrote:
    OK, so I can create procedureN off package1 claiming enforcement procedureN package1.proc1 and grant privileges to User1.

    Is this possible without rights for package1.proc1?

    Yes, it is possible. If user_x has EXECUTE privileges on procedureN procedureN has DEFINE AUTHID (which is the default), then user_x doesn't have privileges on the packaging or the tables used in procedureN.

  • Problem: Not sufficient privileges execution of stored procedure in a package

    I am using Visual Studio 2008 Team Suite, ODT with ODAC 111.07.20 and I am trying to run a procedure stored within a packet, it displays the following error message:

    Oracle.DataAccess.Client.OracleException: ORA-01031: insufficient privileges
    ORA-06512: at & quot; KIKO. PACK_SP & quot; line 205
    ORA-06512: at line 1
    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper (Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx * pOpoSqlValCtx, ByVal src, String, Boolean Bcheck procedure)
    at Oracle.DataAccess.Client.OracleException.HandleError (Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx * pOpoSqlValCtx, ByVal src, Boolean Bcheck)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery)
    at SqlOracleWebService.OracleReplicationTool.GetData (String strNameServer, String strNameDatabase, String strNameTable, String strNameStoreProcedure, String strUserId, String strPassword, intSince, intUntil, Int32 intPort, string strID Int64 Int64) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Oracle\OracleReplicationTool.vb:line 1171
    at SqlOracleWebService.OracleReplicationTool.SmallDataInit (String strNameServerSource, String strNameDatabaseSource, String strNameServerDestiny, String strNameDatabaseDestiny, String strNameTable, String strUserIdSource, String strPasswordSource, String strUserIdDestiny, String strPasswordDestiny, Int32 intPortSource, Int32 intPortDestiny) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Oracle\OracleReplicationTool.vb:line 614
    at SqlOracleWebService.OracleReplicationTool.ReplicationDataInit (Boolean boolBothDirections, String strNameServerSource, String strNameDatabaseSource, String strNameServerDestiny, String strNameDatabaseDestiny, String strNameTable, String strUserIdSource, String strPasswordSource, String strUserIdDestiny, String strPasswordDestiny, Int32 intPortSource, Int32 intPortDestiny) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Oracle\OracleReplicationTool.vb:line 28
    at SqlOracleWebService.Service1.Oracle_ReplicationDataInit (Boolean boolBothDirections, String strNameServerSource, String strNameDatabaseSource, String strNameServerDestiny, String strNameDatabaseDestiny, String strNameTable, String strUserIdSource, String strPasswordSource, String strUserIdDestiny, String strPasswordDestiny, Int32 intPortSource, Int32 intPortDestiny) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Service1.asmx.vb:line 20

    I have change the execute privileges and granted to the user KIKO execute the PACK_SP package, but it does not work. Could you help me?

    Thanks in advance.

    Published by: user9112176 on February 8, 2010 10:27

    This behavior is probably not related to the ODP and will happen when you run the same procedure as the same user of SQLPlus directly for example, so the PLSQL forum is probably a more appropriate place for assistance.

    What is 'KIKO. PACK_SP', line 205? Roles are disabled inside stored procedures, so you must have the permissions that are granted directly.

    It will be useful,
    Greg

  • limit multiple executions of a procedure

    Hi all

    I would limit the simultaneous executions of a procedure. In other words, you want to serialize. Pretty simple, I use locking mechanism for this, but this procedure has a parameter which is a ref cursor and the lock will be released as soon as the ref cursor is open and control reaches the end of the procedure, but I is to restrict users to not be able to perform this procedure again until the closure of this ref cursor Is it possible that this can be achieved with in Oracle DB?

    Example Code:

    CREATE OR REPLACE PROCEDURE SH.SALES_BY_PRODUCT(P OUT SYS_REFCURSOR) IS
    BEGIN
    ..... --Lock here
      OPEN P FOR
        SELECT PROD_ID, SUM(AMOUNT_SOLD) AS AMOUNT FROM SH.SALES GROUP BY PROD_ID;
    ..... --Release the lock here --This approach of locking is not helping as the lock is released even before the cursor P is closed by the calling application.
    END;
    
    

    Thank you!

    You could get an application lock using package of dbms_lock which can be taken on the border of a transaction (commit) until you release or the session ends.

    HTH

  • ODI-1226: Error_log_procedure step fails after 1 attempt. ODI-1232: the execution of the procedure error_log_procedure failed. ODI-1246: the logical schema has not been defined for error_log_procedure.

    I created a procedure running during the mapping fails but I am facing this error

    ODI-1226: Error_log_procedure step fails after 1 attempt.

    ODI-1232: the execution of the procedure error_log_procedure failed.

    ODI-1246: the logical schema has not been defined for error_log_procedure.

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:754)

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:730)

    at oracle.odi.runtime.agent.execution.SessionTask.getExecutor(SessionTask.java:239)

    at oracle.odi.runtime.agent.execution.SessionTask.processTask(SessionTask.java:152)

    at oracle.odi.runtime.agent.execution.SessionTask.doExecuteTask(SessionTask.java:111)

    at oracle.odi.runtime.agent.execution.AbstractSessionTask.execute(AbstractSessionTask.java:864)

    to oracle.odi.runtime.agent.execution.SessionExecutor$ SerialTrain.runTasks (SessionExecutor.java:2024)

    at oracle.odi.runtime.agent.execution.SessionExecutor.executeSession(SessionExecutor.java:562)

    to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:718)

    to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:611)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:203)

    at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doProcessStartAgentTask(TaskExecutorAgentRequestProcessor.java:800)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 1400 (StartSessRequestProcessor.java:74)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:702)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:180)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:108)

    to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:471)

    at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)

    at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)

    at java.util.concurrent.FutureTask.run(FutureTask.java:262)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:724)

    Navigate to the ODI object with the name error_log_procedure , which I assume is an ODI procedure. On the target tab (and if this source) make sure that you have specified a logical schema in the appropriate drop-down box

  • Debug/run procedures within the package

    Debugging with SQL Developer was generally very nice and I have come to rely on these tools. Today, I've written a procedure in a package and I want to debug this process, but I don't see it in the list of targets. It seems that I see only functions in the target list. I understand that the procedures need not have the same kind of output in function, but sometimes I like to create procedures that have multiple SETTINGS, especially when it comes to an exit very closely related.

    The interesting thing is that I can create this same procedure as a stand-alone procedure and the run/debug works great. Apparently I'm missing something obvious in SQL Developer somewhere I thought it was there all the time (I guess for a while since I've written a procedure with OUT parameters) but maybe I'm wrong. Any ideas or help someone?

    Earl

    It should work.

    Is that you can create a package of simple heel with just a function procedure that is a NULL; and use it as a test?

    If this does not work there either, please send a screenshot so we can see what you see in the debugging with the missing procedure dialog box.

  • ODP 12 c version 3 with EF 6.1.1 I can't add Stored Procedure of a package to my model

    I use the ODP 12 c Release 3 (12.1.0.2.1), with Entity Framework 6.1.1 with the first database in MS Visual Studio 2013 update 4

    I have a MVC 5 (.Net Framework 4.5.2) project that connects to Oracle 11 G R2 Database server, an existing database (Tables, views and a pack of Stored procedures)

    I can add tables and use them successfully in my model
    I can add a simple stored procedure

    Here's the problem:
    I have my .edmx file right click and click on "update model from database...". «, on the 'Add' tab, I chose «Stored procedures and functions»
    I can see the list of procedures stored in the package (format packageName.usp) and check the box for the stored procedure of my package, then click 'Finish' to start the update process.

    No stored procedures have been added to my Model.Store


    The only possible exit I get the 'entity data model' is:
    Generated template file: Model1.edmx.
    Loading metadata from the database took 00:00:00.5803351.
    The model generation took 00:00:00.3761861.

    How to add a stored procedure from a package with the Entity Framework 6.1.1?

    I found the answer.

    When in the edmx model and you right click "Update Model database.

    Uncheck "Import selected stored procedures and functions in the entity model", select the package and update procedures. (It works)

    Then in "Model Explorer" under "Model. Store\ stored procedures/functions" you will see your procedures in the package (finally). Then their card in "Function Imports".

    I don't understand why unchecking import stored procedures works, but it does.

    I also found easier to simply call the procedure directly and not using Entity Framework, as all my procedures are: insertion, update and deletions and not all parameters mapped on the model for the view.

  • Procedure call to the procedure in one package

    Hello

    I need help to call a procedure within a package.

    I have an ABC package in which I have 3 X Y and Z I procedures I need to call the procedure procedure Y X that belongs to the same package.

    Thanks in advance

    I need to call the procedure procedure Y X that belongs to the same package.

    Just make sure that this procedure that is has been defined before the X procedure in the package body. However, there no need this if the two procedures are also defined in the package specification.

  • Call a procedure in a package

    Hello

    I need help to call a procedure within a package.

    I have an ABC package in which I have 3 X Y and Z I procedures I need to call the procedure procedure Y X that belongs to the same package.

    Thanks in advance

    I have an ABC package in which I have 3 X Y and Z I procedures I need to call the procedure procedure Y X that belongs to the same package.

    This forum, as the title suggests, is for developer Sql questions only and NOT for questions of SQL or PL/SQL.

    If this is not related to Sql Developer then please mark ANSWERED and repost it in SQL and PL/SQL forum

    https://community.Oracle.com/community/Developer/English/oracle_database/sql_and_pl_sql

    During the validation you must provide your name and full version.

    You must also explain why even need help because procedure X can call just procedure Y directly since they are in the same package.

    For an Oracle DB, see documentation and examples of ' packages of PL/SQL to help "in the doc of the PL/SQL language

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/packages.htm#CIHIJECJ

  • Can only establish us a specific procedure in the package body?

    Hi experts

    Say we have a package as follows:

    package my_package

    a procedure;

    procedure b;

    procedure c;

    end packege my_package;

    my_package package body

    procedure a

    is

    ....

    end;

    procedure b

    is

    ....

    end b;

    procedure c

    is

    ....

    c end;

    end of packet my_package;

    I want to only change the procedure has, should I compile the body together for this? Can I do to compile the procedure like the following?

    create or replace the my_package.procedure one

    is

    ....

    end my_package.a;

    Thank you

    Hello

    No, you must recompile the entire body.  There is no way to compile a procedure in the package.

  • why there is no output after execution of the procedure

    Hi all

    SQL > set serveroutput size 1000000

    SQL > set echo on

    SQL > set comments on

    SQL > declare

    2 number (19) n;

    3 v_startday varchar2 (100): = ' 01 /' 07/2013;

    4 v_owner varchar2 (100): = "SLIMSINTDM";

    5 v_audit_tab audit_var: = audit_var();

    v_table_name 6 varchar2 (40);

    7 type cur_type is ref cursor;

    8 v_cur cur_type.

    v_first_name 9 varchar2 (100);

    v_last_name 10-varchar2 (100);

    11 v_out_tab varchar2 (100);

    v_lab_code 12 varchar2 (10);

    13 v_sql varchar2 (20000);

    14 v_sql_1 varchar2 (10000): = q']

    15 select distinct au.first_name, au.last_name,.

    16: v_table_name table_name, lab_code

    Lab 17 l

    18 join aus app_user_security on AUS.owning_lab_id = l.lab_id

    19 join app_user AU AU. APP_USER_ID = AUS. Join APP_USER]';

    20 v_sql_2 varchar2 (10000): = q'[t on (t.ADDED_BY = to THE.)] APP_USER_ID

    21 or t.last_modified_by = au.app_user_id)

    22 where lab_locale = 'en_AU '.

    23 and (t.added_date > to_date (: v_startday, "MM/DD/YYYY"))

    24 or t.last_modified_date > to_date (: v_startday, "MM/DD/YYYY"))

    25 order by last_name, first_name

    26     ]';

    start 27

    28 n: = 0;

    29 because me to (select table_name from all_tables where owner = v_owner order of table_name)

    loop 30

    31 v_table_name: = substr (i.table_name, 1, instr (i.table_name, '_JN') - 1);

    32 - dbms_output.put_line ('v_table_name: ' | v_table_name |'; i.table_name: ' | i.table_name);

    33 v_sql: = v_sql_1 | i.table_name | v_sql_2;

    34 - dbms_output.put_line (v_sql);

    start at 35

    36 open v_cur for v_sql using v_table_name, v_startday, v_startday;

    37 loop

    38 extract v_cur in v_first_name, v_last_name, v_out_tab, v_lab_code;

    39 exit when v_cur % NOTFOUND;

    40               n := n + 1;

    41 v_audit_tab.extend;

    42 v_audit_tab (n): = audit_type (v_first_name, v_last_name, v_out_tab, v_lab_code);

    43 end loop;

    44 close v_cur;

    45 emergency

    46 then than others then

    then 47 cases sqlcode = - 1030 - insufficient privileges

    48 dbms_output.put_line (' no privs to ' |) THE USER | "on" | i.table_name);

    49 exit;

    50 end if;

    51 end;

    52 end loop;

    53 x in (select * from table (v_audit_tab))

    loop 54

    55 dbms_output.put_line (x.first_name |) «, » || x.last_name | ',' | x.table_name | ',' | x.lab_code);

    loop end 56;

    end 57;

    58.

    PL/SQL procedure successfully completed.

    Issue in this case, developer you can't find any (results) output as expected after the execution of this procedure, so is there something wrong?

    Thank you very much.

    When you try this below is query it returns all the lines?

    Select table_name

    from all_tables

    where owner = "SLIMSINTDM."

    order of table_name;

  • 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

  • How many procedures in a package?

    Could you tell me if there is a limit to the number of procedures or kilobytes that can hold a package? I have an old Oracle version 8.1.7.
    Thank you!

    Mark1970 wrote:

    But this means that there is not a real limit in kilobytes for the insertion of procedures in a package?

    No it does not mean that this means there is a limit of 64 KB and this is measured in knots of DIANA, and DIANA nodes are not easy to count.

    In the shared pool, a package spec, specification of object type, stand-alone subprogramme or anonymous block is limited to 64 nodes DIANA K.

    >

    At the theoretical level, I can write and compile a package og several procedures and many MB?

    Regardless of technical limitations, it is not a good idea to create code units that are as big as possible.

  • Mergeing multiple procedures in one package?

    Hello gurus,


    I m moving data from a diagram i, e la source (SRC) schema to the schema an another i, e target (trg) table, only selected columns of a few tables (i, e for 4 tables)


    I m, writing procedures to achieve and maintain this procedure a planner on a daily basis to load



    I m 4 procedures of writing for each of the table... is the procedure that I got
     
    
       create or replace procedure mov_tbl1
       is 
        cursor tbl1_cur as
          select  src.col1,
                     src.col2,
                     src.col3,
                     src.col4
             from source.tbl1 src
              where col1 = ' xyz'
           
        tbl1_cur_rec   tbl1_cur%rowtype;
            
          begin 
                for  tbl1_cur_rec  in tbl1_cur
                loop 
                    insert into tgt.tabl1(col1,col2,col3,col4)
                          values (   tbl1_cur_rec.col1,
                   tbl1_cur_reccol2,
                   tbl1_cur_rec.col3,
                   tbl1_cur_rec.col4);
                         commit
                      exception 
                         when others then 
                            rollback;
                  end loop;
          end;
    
       ---for table 2
    create or replace procedure mov_tbl2
       is 
        cursor tbl2_cur as
          select  src.col1,
                     src.col2,
                     src.col3,
                     src.col4
             from source.tbl2 src
              where col3 = ' abc'
           
        tbl2_cur_rec   tbl2_cur%rowtype;
            
          begin 
                for  tbl2_cur_rec  in tbl2_cur
                loop 
                    insert into tgt.table2(col1,col2,col3,col4)
                          values (   tbl2_cur_rec.col1,
                   tbl2_cur_reccol2,
                   tbl2_cur_rec.col3,
                   tbl2_cur_rec.col4);
                         commit
                      exception 
                         when others then 
                            rollback;
                  end loop;
          end;
    
       
    same procedures for table 3 and table 4...

    Here's my question...
      
    
    1.How can i build a single package for all these four procedures in one package ???
    2. ANd i don't want to call each procedure every time ...so can i do it by passing parameters ???  how can i accomplish that ??
    
     
    I m back to writing packets... all help is greatly appreciated... Thank you so much gurus!

    First your code does not compile because the exception block is inside the loop while begin and end are on the outside.
    You must decide whether a row error should invalidate the full load or if the wrong single line must be rejected, but all other lines have been downloaded.
    I guess you need that last so I change the code as follows:

    create or replace procedure mov_tbl1
       is
        cursor tbl1_cur as
          select  src.col1,
                     src.col2,
                     src.col3,
                     src.col4
             from source.tbl1 src
              where col1 = ' xyz'
           -- 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,col3,col4)
                          values (   tbl1_cur_rec.col1,
                   tbl1_cur_reccol2,
                   tbl1_cur_rec.col3,
                   tbl1_cur_rec.col4);
                         -- REMOVED COMMIT, Commit outside or at the end.
                      exception
                         when others then
                           null; -- May be is better to (somehow) log the error ...
                  end;
                end loop;
          end;
    

    On the package, create you it in this way:

    create or replace package p is
    procedure upd (tab1 in boolean, tab2 in boolean, tab3 in boolean, tab4 in boolean);
    end;
    /
    
    create or replace package p is
    procedure upd (tab1 in boolean, tab2 in boolean, tab3 in boolean, tab4 in boolean) is
    begin
      if tab1=true then
         mov_tbl1;
      end if;
    
      if tab2=true then
         mov_tbl2;
      end if;
    
      if tab2=true then
         mov_tbl2;
      end if;
    
      if tab2=true then
         mov_tbl2;
      end if;
    end;
    
    procedure mov_tbl1   is
        cursor tbl1_cur as
          select  src.col1,
                     src.col2,
                     src.col3,
                     src.col4
             from source.tbl1 src
              where col1 = ' xyz'
           -- 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,col3,col4)
                          values (   tbl1_cur_rec.col1,
                   tbl1_cur_reccol2,
                   tbl1_cur_rec.col3,
                   tbl1_cur_rec.col4);
                         -- REMOVED COMMIT, Commit outside or at the end.
                      exception
                         when others then
                           null; -- May be is better to (somehow) log the error ...
                  end;
                end loop;
          end;
    
    procedure mov_tbl2   is ...
    
    procedure mov_tbl3   is ...
    
    procedure mov_tbl4   is ...
    
    end;
    /
    

    You can call the procedure upd (calling others) this way:

    begin
      p.upd(true,false,true,false);
    end;
    /
    

    Update only table1 and table3.

    Max
    http://oracleitalia.WordPress.com

  • Check if target schema procedure/view/relax/package name...

    As part of the dismantling of the schema, I'm in the process of validation if the schema (say X) is referred to in the procedures/relaxation/view/package in the schema to another (say Y or A or B).

    Schema X is ABOVE in diagrams 'Y' and 'A' in the code of procedures/relaxation/view. Because this scheme X is removed, I want to make sure that the 'X' schema is not mentioned in others.

    Please highlight how I can validate for the above scenario

    Hello

    According to me you should check

    select owner, synonym_name from dba_synonyms where table_owner = 'Schema to be deleted'
    
    select owner, name from dba_source where upper(line) like '%Schema to be deleted%'
    

    Due to the first query can be an object becomes invalid, and then check which packages voided, or you can use dba_dependencies view to find the object

    Concerning
    Anurag Tibrewal.

Maybe you are looking for