Trigger -- if a procedure execution is successfuly

hi,
I have to execute a trigger if a procedure say P1 is completed successfully
Please help me how to solve it
Thanks in Advance
Muniyandi

hi,
I have to execute a trigger if a procedure say P1 is
completed successfullyTRIGGER is an indepenedent feature which execute itself for an event you cant execute TRIGGER at yours own disposal ,while procedure can be called or execute at yours own will.You can call procedure within trigger but cant execute trigger explicitly after any execution of code e.g sp,function etc.
BTW why do you need to call a trigger after successful execution of procedure??
Khurram

Similar Messages

  • Passing Values from a Trigger to a procedure

    Hi,
    How do i pass my OLD and NEW values from a Trigger to a Procedure. THe procedure will contain statements which will insert one record for each column with the OLD and NEW value.( I may have 31 inserts in the LOG table)
    Basically we have a table with 31 fields, i am tracking the changes done on that table, in my trigger i compare IF :OLD.COL1 <> :NEW.COL1 then i am inserting in a LOG Table if the values have changed.
    I am also tracking ie inserting in the LOG table if i am ADDING OR DELETING any row from the tabble.
    Thank yu

    It worked i created a RECORD type variable and passed OLD Value to one variable and NEW value to another variable.
    thanks

  • How to pass the NEW row from a trigger to a procedure

    I want to pass all NEW values from a trigger to a procedure.
    I wish to use a %ROWTYPE or similar,
    and I want neither to assigne them nor pass them one by one.
    Any suggestion?
    Thanks in advance

    hi vittorio
    i have a solution but im very sure it is not exact answer to your question . it will definitely help you .
    create table temp_type as select * from emp where 1 = 2;
    create or replace procedure emp_ins(emp_row emp%rowtype) as
    pragma autonomous_transaction;
    begin
    insert into temp_type(empno,ename) values(emp_row.empno,emp_row.ename);
    commit;
    end;
    create or replace trigger emp_ins_trig before insert on emp for each row
    declare
    /*  empr emp_types.emprowtype%type;*/
    empr emp%rowtype;
    begin
      empr.empno := :new.empno;
      empr.ename := :new.ename;
    emp_ins(empr);
    end;
    /unfortunately , in oracle we dont have a facility to access the members of a record or recordset by their position
    Such facility is very much there in Visual Basic , similar programming tools.
    we can access the members of a recordset by the index position ( here index means the position of the field)

  • Function and procedure execution

    hi all,
    i have question in procedure execution and function execution oracle database.
    i want know that which is faster in execution procedure or function.
    can i see the time taken by procedure and select query
    i want to see only time not cpu cost or anything else.
    i am waiting for your responses...

    There is no difference in cost between whether something is a function or a procedure.
    The decision making should reflect usage only. For example you can not use a procedure in SQL.
    If you wish to break things down further focus on 10046 and 10053 tracing.
    Seeing time only is roughly equivalent to cutting off all of your fingers to see how something feels to your thumb.
    Timing is only one very small part of what you should be watching.

  • Disable text while procedure execution

    Hi,
    oracle9i
    How to disable the below text while procedure execution ?
    old  15: Procedure_name(&var1);
    new  15: Procedure_name(&var2);
    Regards

    Use SET VERIFY OFF.
    It won't make any difference in the output that you get, but its just for you to see which variable is getting replaced by which value.

  • How can i check the procedure execution time..?

    Hi All,
    Can any one of you tell me how can i check the procedure execution time..?
    Thanks in advance.

    if running it from SQL*Plus,
    SQL> set timing on
    Or from PL/SQL, use DBMS_UTILITY.GET_TIME before and after the call and calclate the difference.

  • Please help me how to maintain log for procedure execution

    Hi Experts,
    How to maintain the log for procedure execution
    I want to maintain the log for procedures as below.
    Once the procedure starts it should show status as RUNNING and PROC_END_TIME should be NULL.
    Once the procedure completes it should show status as COMPLETED and shold show the PROC_END_TIME.
    Once the MAIN_PROC completes then only the status of that procedure should show COMPLETED.
    STEP_ID RECORDS_INS_UPD  RECORDS_DELETED PROC_NAME PROC_START_TIME                PROC_END_TIME              JOB_STATUS ERROR_MSG
    1 500             0  MAIN_PROC 1/4/2014 5:47:38.000000 AM                         RUNNING
    2 100             0  SUB_PROC1 1/4/2014 5:49:30.000000 AM                         RUNNING
    3  0             0  SUB_PROC2 1/4/2014 5:47:38.000000 AM 1/4/2014 5:47:38.000000 AM COMPLETED
    I have tried the below code but it's not working properly.
    CREATE OR REPLACE PROCEDURE procedures_log
       p_seq                NUMBER,
       p_rec_ins_upd        NUMBER,
       p_rec_deleted        NUMBER,
       p_proc_name          VARCHAR2,
       p_start_time         TIMESTAMP,
       p_end_time           TIMESTAMP,
       p_job_status         VARCHAR2,
       p_error_msg          VARCHAR2
    IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
        IF p_seq = 0 THEN
            INSERT INTO proc_log
                STEP_ID,
                ORG_ID,
                TABLENAME,
                RECORDS_INS_UPD,
                RECORDS_DELETED,
                JOB_NAME,
                PROC_NAME,
                JOB_START_TIME,
                JOB_END_TIME,
                JOB_STATUS,
                ERROR_MSG
            VALUES
                p_seq,
                p_rec_ins_upd,
                p_rec_deleted,
                p_proc_name,
                p_start_time,
                p_end_time,
                p_job_status,
                p_error_msg
        ELSE
            UPDATE proc_log
            SET
                RECORDS_INS_UPD = p_rec_ins_upd,
                RECORDS_DELETED = p_rec_deleted,
                JOB_END_TIME = p_end_time,
                JOB_STATUS = p_job_status,
                STEP_ID = p_seq,
                ERROR_MSG = p_error_msg
            WHERE UPPER(TRIM(PROC_NAME)) = UPPER(TRIM(p_proc_name))
            AND STEP_ID = 0
            AND JOB_STATUS = 'RUNNING';
        END IF;
        COMMIT;
        EXCEPTION
            WHEN OTHERS
            THEN NULL;
    END;
    Please help me.
    Thanks.

    ramya_162 wrote:
    Hi,
    I don't want to maintain multiple records for one procedure.
    The log table will grow huge.
    Please help me.
    Thanks.
    You have two options.
    Either a running log, from which you periodically delete old records, or maintain a standing record  for each process you are tracking.
    Ok, let's take the second, since that seems to be your preferred method.
    Going back to your original post, you gave us code and said "I have tried the below code but it's not working properly."
    Please define "not working".  That statement is totally devoid of actionable or diagnostic information. 

  • Table Trigger and Stored Procedure Question

    I'm rusty with triggers/procedures and have a quick question.
    If a rollback occurs within a procedure containing a raise_applciation_error called from a table insert trigger, will this prevent the insert on the table from occuring?
    I want the transaction to be occur on the table even though an exception is raised within the called procedure.

    If the trigger is an "after insert" and the procedure called by the trigger raises an error, will the row still be inserted?
    SQL> create table t (n number);
    Table created.
    SQL> create or replace
      2  procedure p as
      3  begin
      4     raise_application_error(-20001,'Something bad happened');
      5  end;
      6  /
    Procedure created.
    SQL> create or replace
      2  trigger t_trig
      3  after insert
      4  on t
      5  begin
      6     p;
      7  end;
      8  /
    Trigger created.
    SQL> insert into t values (42);
    insert into t values (42)
    ERROR at line 1:
    ORA-20001: Something bad happened
    ORA-06512: at "SELSE.P", line 3
    ORA-06512: at "SELSE.T_TRIG", line 2
    ORA-04088: error during execution of trigger 'SELSE.T_TRIG'
    SQL> select * from t;
    no rows selected

  • Pricing procedure execution...

    Hi Folks,
    How SAP reads the pricing procedure..
    Example
    Con.Type      Requirement        Routine
    ZSAA            601                     901
    ZSAB            602                     902
    Doubt 1: -Is system reads this pricing procedure line by line or coulmn by column?, In the debug we noticed it goes column by colmun? why?
    Doubt 2: - I want to know the value found for ZSAA during the execution of 602 requirement. Example scenario is if ZSAA is more than 100$ don't execute ZSAB.

    Pricing Procedure:
    Determination of Pricing Procedure:
    In SD, Pricing Procedure is determined based on Sales Area (Sales Organization + Distribution Centre + Division) + Customer Pricing Procedure + Document Pricing Procedure through T.Code: OVKK. Sales Area is determined in Sales Order Header Level. Customer Pricing Procedure is determined from Customer Master. Document Pricing Procedure is determined from Sales Document Type / Billing Type (if configured). Once the pricing procedure is determined, Condition records are fetched. If appropriate condition records are found, the price is determined. If Mandatory pricing condition is missing, system will through an error message.
    Configuration of Pricing Procedure:
    Step 1:
    Condition table (T.Code: V/04): If existing condition table meets the requirement, we need not create a new condition table. Considering the requirement for new condition table, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Table (select the required fields combination, which will store condition record).
    Step 2:
    Access Sequence (T.Code: V/07): If existing access sequence meets the requirement, we need not create a new access sequence. Considering the requirement for new sequence, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Access Sequence (Access sequence is made up of Accesses (Tables) & the order of priority in which it is to be accessed. Here we assign the condition table to access sequence.
    Step 3:
    Condition Type (T.Code: V/06): If existing condition type meets the requirement, we need not create a new condition type. Considering the requirement for new condition type, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Type. It is always recommended to copy an existing similar condition type & make the neccessary changes. Here we assign Access sequence to Condition type.
    Step 4:
    a. Pricing Procedure (T.Code: V/08):  It is recommended to copy a similar pricing procedure & make the neccesary changes in new pricing procedure. Pricing Procedure is a set of condition type & arranged in the sequence in which it has to perform the calculation. Considering the requirement for new Pricing Procedure, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Maintain Pricing Procedure.
    b. Pricing Procedure (T.Code: VOK0): After maintaining the pricing procedure the next step will be determination of pricing procedure. Configuration for determining pricing procedure in SPRO is as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Determine Pricing Procedure.
    5. Condition record (T.Code: VK11 / VK12): Condition record is a master data, which is required to be maintained by Core team / person responsible from the client. During new implementation, the condition records can be uploaded using tools like SCAT, LSMW, etc. Condition Record is maintained in T.Code: VK11 / VK12, which are captured in Sales Order & Billing.
    Also check document pricing procedure in Sales Document Type (T.Code: VOV8 - Sales order Type, VOFA: Billing Type (If Required)), customer pricing procedure in Customer Master Data (T.Code: XD02), ... are in place.
    Regards,
    Rajesh Banka
    Reward suitable points.

  • Procedure execution time difference in Oacle 9i and Oracle 10g

    Hi,
    My procedure is taking time on
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 is 14 min.
    same procedure is taking time on oracle Release 9.2.0.1.0 is 1 min.
    1) Data is same in both environment.
    2) Number of records are same 485 rows for cursor select statement.
    3)Please guide me how to reduce the time in oracle 10g for procedure?
    i have checked the explain plan for that cursor query it is different in both enviroment.
    so i have analysis that procedure is taking time on cursor fetch into statement in oracle 10g.
    example:-
    create or replace procedure myproc
    CURSOR cur_list
    IS select num
    from tbl
    where exist(select.......
    EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE = TRUE';
    EXECUTE IMMEDIATE 'ALTER SESSION SET TIMED_STATISTICS = TRUE';
    OPEN cur_list;
    LOOP
    FETCH cur_list INTO cur_list; -----My procedure is taking time in this statement only for some list number. there are 485 list number.
    end loop;
    TRACE file for oracle 10g is look like this:-
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.37 0.46 0 2 0 0
    Fetch 486 747.07 730.14 1340 56500700 0 485
    total 488 747.45 730.60 1340 56500702 0 485
    ORACLE 9i EXPLAIN PLAN FOR cursor query:-
    Plan
    SELECT STATEMENT CHOOSECost: 2 Bytes: 144 Cardinality: 12                                         
         18 INDEX RANGE SCAN UNIQUE LISL.LISL_LIST_PK Cost: 2 Bytes: 144 Cardinality: 12                                    
              17 UNION-ALL                               
                   2 FILTER                          
                        1 TABLE ACCESS FULL SLD.P Cost: 12 Bytes: 36 Cardinality: 1                     
                   16 NESTED LOOPS Cost: 171 Bytes: 141 Cardinality: 1                          
                        11 NESTED LOOPS Cost: 169 Bytes: 94 Cardinality: 1                     
                             8 NESTED LOOPS Cost: 168 Bytes: 78 Cardinality: 1                
                                  6 NESTED LOOPS Cost: 168 Bytes: 62 Cardinality: 1           
                                       4 TABLE ACCESS BY INDEX ROWID SLD.L Cost: 168 Bytes: 49 Cardinality: 1      
                                            3 INDEX RANGE SCAN UNIQUE SLD.PK_L Cost: 162 Cardinality: 9
                                       5 INDEX UNIQUE SCAN UNIQUE SLD.SYS_C0025717 Bytes: 45,760 Cardinality: 3,520      
                                  7 INDEX UNIQUE SCAN UNIQUE SLD.PRP Bytes: 63,904 Cardinality: 3,994           
                             10 TABLE ACCESS BY INDEX ROWID SLD.P Cost: 1 Bytes: 10,480 Cardinality: 655                
                                  9 INDEX UNIQUE SCAN UNIQUE SLD.PK_P Cardinality: 9           
                        15 TABLE ACCESS BY INDEX ROWID SLD.GRP_E Cost: 2 Bytes: 9,447 Cardinality: 201                     
                             14 INDEX UNIQUE SCAN UNIQUE SLD.PRP_E Cost: 1 Cardinality: 29                
                                  13 TABLE ACCESS BY INDEX ROWID SLD.E Cost: 2 Bytes: 16 Cardinality: 1           
                                       12 INDEX UNIQUE SCAN UNIQUE SLD.SYS_C0025717 Cost: 1 Cardinality: 14,078      
    ORACLE 10G EXPLAIN PLAN FOR cursor query:-                                   
         SELECT STATEMENT ALL_ROWSCost: 206,103 Bytes: 12 Cardinality: 1                                         
         18 FILTER                                    
              1 INDEX FAST FULL SCAN INDEX (UNIQUE) LISL.LISL_LIST_PK Cost: 2 Bytes: 8,232 Cardinality: 686                               
              17 UNION-ALL                               
                   3 FILTER                          
                        2 TABLE ACCESS FULL TABLE SLD.P Cost: 26 Bytes: 72 Cardinality: 2                     
                   16 NESTED LOOPS Cost: 574 Bytes: 157 Cardinality: 1                          
                        14 NESTED LOOPS Cost: 574 Bytes: 141 Cardinality: 1                     
                             12 NESTED LOOPS Cost: 574 Bytes: 128 Cardinality: 1                
                                  9 NESTED LOOPS Cost: 573 Bytes: 112 Cardinality: 1           
                                       6 HASH JOIN RIGHT SEMI Cost: 563 Bytes: 315 Cardinality: 5      
                                            4 TABLE ACCESS FULL TABLE SLD.E Cost: 80 Bytes: 223,120 Cardinality: 13,945
                                            5 TABLE ACCESS FULL TABLE SLD.GRP_E Cost: 481 Bytes: 3,238,582 Cardinality: 68,906
                                       8 TABLE ACCESS BY INDEX ROWID TABLE SLD.L Cost: 2 Bytes: 49 Cardinality: 1      
                                            7 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PK_L Cost: 1 Cardinality: 1
                                  11 TABLE ACCESS BY INDEX ROWID TABLE SLD.P Cost: 1 Bytes: 16 Cardinality: 1           
                                       10 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PK_P Cost: 0 Cardinality: 1      
                             13 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.SYS_C0011870 Cost: 0 Bytes: 13 Cardinality: 1                
                        15 INDEX UNIQUE SCAN INDEX (UNIQUE) SLD.PRP Cost: 0 Bytes: 16 Cardinality: 1      
    so Please guide me how to reduce the time in oracle 10g for procedure?
    1) Is this envrionment setting parameter?
    2) I have to tune the query? but which is executing fine on oracle 9i?
    so how to decrease the execution time?
    Thanks in advance.

    SELECT l_nr
    FROM x.ls b
    WHERE b.cd = '01'
    AND b.co_code = '001'
    AND EXISTS (
    SELECT T_L
    FROM g.C
    WHERE C_cd = '01'
    AND C_co_code = '001'
    AND C_flg = 'A'
    AND C_eff_dt <= sysdate
    AND C_end_dt >=
    sysdate
    AND C_type_code <> 1
    AND C_type_code <> 1
    AND targt_ls_type = 'C'
    AND T_L <> 9999
    AND T_L = b.l_nr
    UNION ALL
    SELECT l.T_L
    FROM g.C C,
    g.ep_e B,
    g.ep ep,
    g.e A,
    g.lk_in l
    WHERE l.cd = '01'
    AND l.co_code = '001'
    AND l.cd = C.C_cd
    AND l.co_code = C.C_co_code
    AND l.C_nbr = C.C_nbr
    AND l.targt_ls_type = 'C'
    AND lk_in_eff_dt <=
    sysdate
    AND lk_in_end_dt >=
    ( sysdate
    + 1
    AND ( (logic_delte_flg = '0')
    OR ( logic_delte_flg IN ('1', '3')
    AND lk_in_eff_dt <> lk_in_end_dt
    AND l.cd = ep.C_cd
    AND l.co_code = ep.C_co_code
    AND l.C_nbr = ep.C_nbr
    AND l.ep_nbr = ep.ep_nbr
    AND l.cd = A.e_cd
    AND l.co_code = A.e_co_code
    AND l.e_nbr = A.e_nbr
    AND l.cd = B.cd
    AND l.co_code = B.co_code
    AND l.C_nbr = B.C_nbr
    AND l.ep_nbr = B.ep_nbr
    AND l.e_nbr = B.e_nbr
    AND l.ep_e_rev_nbr = B.ep_e_rev_nbr
    AND B.flg = 'A'
    AND EXISTS (
    SELECT A.e_nbr
    FROM g.e A
    WHERE A.e_cd = B.cd
    AND A.e_co_code = B.co_code
    AND A.e_nbr = B.e_nbr
    AND A.e_type_code ^= 8)
    AND C_type_code <> 10
    AND C.C_type_code <> 13
    AND l.T_L = b.l_nr)
    --yes index is same                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to know child procedure Execution time with in parent procedure

    Hi Team,
    I've a requirement in which I need to get the execution time of a child procedure while its running in a parent procedure in PLSQL. While the child process is running, I want to know its execution time so that if it execution time exceeds more than 5 seconds than I want to through an error. Please let me know by what means this can be achieved in plsql.
    Regards,
    Tech D.

    TechD wrote:
    Hi Team,
    I've a requirement in which I need to get the execution time of a child procedure while its running in a parent procedure in PLSQL. While the child process is running, I want to know its execution time so that if it execution time exceeds more than 5 seconds than I want to through an error. Please let me know by what means this can be achieved in plsql.
    Regards,
    Tech D.PL/SQL is NOT a Real Time programming language.
    The procedure that invokes the child procedure is effectively dormant while the child runs.
    Plus there is no easy way to know when 5 seconds has elapsed.

  • Measure procedure execution time..

    Hi,
    Is there any possibility to measure how long each of a procedure in database take?? Is that possible for Oracle's V$ views or by performance report like AWR? On the other hand, is that possible to measure execution time for SQL statements, but without using "set timing on".
    Best,
    tutus

    This is just an add-on to Satish's reply. You may want to chck this link to see how Profiler works,
    http://www.oracle-base.com/articles/9i/DBMS_PROFILER.php
    HTH
    Aman....

  • Recurring Doc Posting Procedure & Execution

    Hi Experts,
    Kindly inform the Procedure for Recurring Doc Posting  & Execution ( Is helpful in real time)
    Thk & Reg
    Vasu

    Hi,
    There are following steps for recurring entry posting
    1. Create Recurring Document in FBD1 and can display document in FBD3
    2. Create Posting documents from recurring document F.14
    3. Run Batch input session in SM35
    You can see accounting document in log.
    if helpful, Please assign points.
    For any query Please let me know.
    Regards
    Pawan Gupta

  • Resume procedure execution after Exception Handler

    Hi -- Can anyone tell me how to resume execution of my procedure if and when I fall into the Exception Handler?
    I'm in a for/loop and i want to move to the next record after falling into the exception handler.
    Thanks,
    ~Christine

    It's just a scoping issue...
    BEGIN
        FOR r IN ( SELECT ... FROM whatever ) LOOP
           BEGIN
               --  do stuff
           EXCEPTION
                 WHEN others THEN
                      log_error(SQLERRM);
           END;
         END LOOP;
    END;
    /If you're using BULK processing you may want to check out %BULK_EXCEPTIONS.
    Cheers, APC

  • Long procedure execution time

    Hello,
    I hav a procedure which consists of select and insert statements(includes Union, Minus, DataType conversions etc.). Three tables of around 27 fields each, are involved in procedure. Table has around 87-90 lakhs of records. This procedure is taking around 7-8 hours for execution.
    There is another almost exactly same procedure with tables of almost same fields, takes less than 5 minutes for execution. How can I optimize the previous procedure so that execution time is reduced.
    Thanks.

    Table has around 87-90 lakhs of records. 1 lakh is 100,000 records.
    How can I optimize the previous procedure so that execution time is reduced.Without even knowing how the procedure looks, we can't comment or even able to help you. Apart from the number of columns and rows, we don't have any other information regarding your procedure or data or index.
    Please elaborate so that anyone can help you.
    Cheers
    Sarma.

Maybe you are looking for