:NEW cannot be used in After Delete Trigger ?

Hi,
Is there any way to get the :NW.value in the After delete trigger for each row. My requirement is audit log of the end user DML operations along with user Name (HERE THE USER IS NOT THE ORACLE USER, BECAUSE OF THE LARGE NUMBER OF END USERS WE ARE MAINTAINING ONE TABLE TO CREATE USER NAME & PASSWORD, WHEN THE USER LOGIN TO ORACLE FORM SCREEN, ASSIGN THE USER NAME TO GLOBAL VARIABLE) & Action Date.
Here is my code for trigger - It is working fine with INSER & UPDATE but for DELETE User is NULL
CREATE OR REPLACE TRIGGER Tgr_stud_det
AFTER INSERT OR UPDATE OR DELETE ON student_details
FOR EACH ROW
DECLARE
BEGIN
IF Inserting THEN
-------------INSERT VALUE---------------
INSERT INTO Log_student_details
(Seq,
App_User,
Action,
Action_Date,
stud_name,
stud_age,
stud_sex)
VALUES
(stud_sequence.NEXTVAL,
:NEW.App_User,
'INSERT',
SYSDATE,
:NEW.stud_name,
:NEW.stud_age,
:NEW.stud_sex);
-------------DELETE VALUE---------------
ELSIF Deleting THEN
INSERT INTO Log_student_details
(Seq,
App_User,
Action,
Action_Date,
Comment_Up,
stud_name,
stud_age,
stud_sex)
VALUES
(stud_sequence.NEXTVAL,
:OLD.App_User,
'DELETE',
SYSDATE,
NULL,
:OLD.stud_name,
:OLD.stud_age,
:OLD.stud_sex);
ELSIF Updating THEN
-------------UPDATE VALUE---------------
INSERT INTO Log_student_details
(Seq,
App_User,
Action,
Action_Date,
Comment_Up,
stud_name,
stud_age,
stud_sex)
VALUES
(stud_sequence.NEXTVAL,
:NEW.App_User,
'UPDATE',
SYSDATE,
'NEW VALUE',
:NEW.stud_name,
:NEW.stud_age,
:NEW.stud_sex);
INSERT INTO Log_student_details
(Seq,
App_User,
Action,
Action_Date,
Comment_Up,
stud_name,
stud_age,
stud_sex)
VALUES
(stud_sequence.CURRVAL,
:NEW.App_User,
'UPDATE',
SYSDATE,
'OLD VALUE',
:OLD.stud_name,
:OLD.stud_age,
:OLD.stud_sex);
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END Tgr_stud_det;
Thanks in advance.

Rizly,
As i mentioned in the above post, you should remove the references of :old and :new when you are trying to use the global variables. These values are only significant when you the talk about the record in the table.
For the scenario, you explained, your trigger would insert two records....The trigger would be fired twice.. once during the insert and once during the delete. The audit table will have two records indicating both the actions..
Take a look at this example below...I am artificially manufacturing a user id in the package test_pkg and using that in the insert trigger. As i explained above, you dont need the :old and :new references because the user id is not a column in the table . hence the :old and :new references have no relevance.
Also note that, for the delete, I use the :old value and for the insert, I use the :new value.
for update, I assume you want to store the old record and hence used :old (you can of course use :new too..technically.).
I don't have access to a forms environement, but the user id logic should be similar to what I described below.
sql> create table t(
  2     id number,
  3     name varchar2(20)
  4  );
Table created.
sql> create table t_audit
  2     ( id number,
  3       name varchar2(20),
  4       action varchar2(20),
  5       user_id varchar2(20)
  6  );
Table created.
sql> create or replace package test_pkg as
  2      function get_user_id return varchar2;
  3  end test_pkg;
  4  /
Package created.
sql> create or replace package body test_pkg as
  2      function get_user_id return varchar2 is
  3      begin
  4          return 'USER' || to_char(sysdate,'HH24:MI');
  5      end get_user_id;
  6  end test_pkg;
  7  /
Package body created.
  1  create or replace trigger trg_biud_t
  2     before insert or update or delete on t
  3     for each row
  4  begin
  5     if INSERTING then
  6        insert into t_audit values (:new.id, :new.name, 'INSERT',test_pkg.get_user_i
  7     elsif UPDATING then
  8        insert into t_audit values (:old.id, :old.name, 'UPDATE',test_pkg.get_user_i
  9     elsif DELETING then
10        insert into t_audit values (:old.id, :old.name, 'DELETE',test_pkg.get_user_i
11     end if;
12* end;
sql> /
Trigger created.
sql> select * from t;
no rows selected
sql> select * from t_audit;
no rows selected
sql> insert into t values (100, 'Rajesh');
1 row created.
sql> insert into t values (200,'Kumar');
1 row created.
sql> delete from t where id = 200;
1 row deleted.
sql> commit;
Commit complete.
sql> select * from t
  2  /
        ID NAME
       100 Rajesh
sql> select * from t_audit;
        ID NAME                 ACTION               USER_ID
       100 Rajesh               INSERT               USER15:36
       200 Kumar                INSERT               USER15:36
       200 Kumar                DELETE               USER15:37

Similar Messages

  • Selective use of a delete trigger

    Is there a way for me to use a delete trigger selectively?
    I have a table that on certain instances, when a record is deleted the 'deleted' record needs to be inserted into an archive table. On other times, the delete must just delete and no archive created.
    because I have a DELETE trigger, it is firing everytime a delete happens.
    Is there a way I can 'suspend' the trigger for those times?
    for example:
    DELETE /*+ No trg_del_price */ from PRICE where <where clause here>

    We have a price table that in some situations, multiple prices come in for the same account. We have an SP that does a clean-up routine and if it finds records that needs to be cleaned up, it updates those and then deletes the other records (as they are now duplcate). In these cases, I don't want the 'extra' records inserted into the archive table.
    (Note that this was not my code - but the original code written by a former DBA that has since left. It would be too complicated and time-consuming to rewrite the whole logic to not have this clean-up routine in the first place).
    If the record is truely deleted in all other cases, then I do want the record inserted. For that I call a trigger that calls a SP to do the insert.
    If I cannot do a selective trigger, can I put logic in the trigger that can check the source of the trigger - if from this clean-up SP, then don't fire....
    Sean

  • Firefox cannot find profile, even after deleting and re-installing.

    I un-installed firefox when the problem first started, then re-installed it. Still cannot find profile. I went through the Profile Manager Wizard, but that didn't work. It couldn't find the program. I'm not on firefox now since it won't load.

    See:
    *https://support.mozilla.org/kb/how-run-firefox-when-your-profile-missing-or-inacc
    This is usually caused by a problem with the profiles.ini file and the profile marked as Default=1 in this file is no longer present on the hard drive.
    *Windows: %AppData%\Mozilla\Firefox\<br>C:\Users\&lt;user&gt;\AppData\Roaming\Mozilla\Firefox\Profiles\&lt;profile&gt;\
    *Linux: ~/.mozilla/firefox/
    *Mac: ~/Library/Application Support/Firefox/
    You can use one of these to make Firefox create/use a new default profile:
    *Delete the profiles.ini file to force Firefox to create a new default profile
    *Use the Profile Manager to create a new profile
    *Use "Choose Folder" when you create a new profile to select the location of a lost profile and recover this profile
    *http://kb.mozillazine.org/Profile_Manager
    *https://support.mozilla.org/kb/Managing+profiles
    *http://kb.mozillazine.org/Profile_folder_-_Firefox

  • No offer to save new password for google toolbar after deleting old one

    After deleting my old gmail and toolbar password in the password manager. I haven't received an offer to save the new password when signing in on the toolbar.

    Thanks again. The only e-mail addresses are associated with my domain - atlantichouse.org.uk. I've typed in "atlantichouse" and it returns no data, so I guess they've all been deleted.
    I don't use a firewall; I have updated Thunderbird earlier today as part of my attempt to solve this problem (it began when both my wife and I were unable to access mail, using different laptops - which I suppose suggests that the problem may not be at our end - though surely it should still be asking me for a PW) but not for some time previously.

  • Cannot surfing using safari after upgrade to OS X Lion

    Hi,
    i just upgrade to OS X Lion, the problem now i cannot surfing using safari, i try open up chrome and firefox they can work well
    FYI, i already empty cookies adn not using any plug-ing
    i also already update the software.
    there any options can i do?
    thank you

    So you can't login to a site? "click enter" ??
    Which website are you referring to?
    Please post the link in your reply  

  • Why Oracle Linux 5 cannot recover disk space after delete files ?

    Folks,
    Hello. When I create a Virtual Machine for Oracle Linux 5 to install EBS R12, I allocate 300GB to the VM. I download EBS R12 Source Files (45.7GB) and unzip the files (46GB). Total size of stage area directory(EBS_R12) is 91.7GB.
    Because some files are corrupted and cannot install, I move the folder EBS_R12 into trash but cannot empty trash. I move EBS_R12 from trash back to the directory. Then at root user, use command "rm -rf " to delete EBS_R12 completely.
    I shut down Oracle Linux 5 and restart it, 91.7GB disk space cannot recover.
    I download some other files into Oracle Linux files and then delete those files, but disk space cannot be recovered either.
    It seems that OEL5 virtual disk only can expand but cannot be reduced. The VM disk space is less than 200GB now and not enough to install EBS R12.
    Can any folks tell me how to make 91.7GB disk space and some more disk space come up ?

    Folks,
    Hello. Thanks a lot for replying.
    Host OS is Windows 7, Guest OS is Oracle Linux 5 on the top of VMPlayer 3. The VM of Oracle Linux 5 is created on the external USB drive and not on the local hard disk.
    There is a directory /tmp/VMwareDnd/376c7cae/EBS_R12 in Oracle Linux 5 file system. I copy/Paste the folder of EBS_R12 from Windows 7 into Oracle Linux 5. All of zip files and unzipped files are placed in the folder of EBS_R12.
    After EBS_R12 is deleted, the external USB drive(F:) doesn't come up 91.7GB disk space.
    My question is:
    Where to run "boot>linux rescue" command ?
    Does this command work correctly in the external USB drive ?

  • Cannot export from iPhoto after deleting photos in its library

    ... because it says it cannot find the original. It asks if I want to search for it myself, but I think it means searching for the ones I've deleted or something. I don't even want to upload those! Help!
    I've read this somewhere else on this forum: "The ! or ? turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents."
    That's exactly what's happening! Why?

    create a new deafult iPhoto preference file - quit iPhoto and go to "your user name" ==> library ==> preferences ==> com.apple.iPhoto.plist and trash it - launch iPhoto which creates a fresh new default preference file . If you make any changes to it make a note of what chane syou have made.
    Do NOT change the preference to copy imported items to the iPhoto library
    depress the option key and laynch iPhoto and create a new library
    Do not ever make any change to its content or structue using the finder or anyother program other than iPhoto
    in iPhoto under the hlep menu go to the iPhoto help videos and watch them
    Import a few photos and practice with iPhoto and ask specific question as you find things you do not understand
    Most important is to never go directly into the iPhoto library - there is no need to and ther are no user servicable parts in it
    LN 

  • Retrieving old column values from a after delete trigger dynamically

    I have a single audit table for deletions
    and the table structure has the following columns
    1: table_name
    2: column_name
    3: column_value
    I am writing a trigger on tables for which i want to have delete audits and i am dynamicaly
    retrieving the column names but i am unable to retrieve the column value dynamically;
    I tried to use the following statement but doesn't return the column value
    sql_stmt:= 'select :1 from dual';
    execute immediate sql_stmt into col_value using
    ':old.'| |v_col_name;
    where v_col_name is the name of the column which i retrieve dynamically using the
    dbms_sql.describe_columns procedure.
    Is their any way if i can retrieve the old column values in the trigger dynamically if i already
    have the column names in variables..
    Thanks in advance.
    null

    I don't know if Kevin's tip Help Mr. Sameer, but it did help me gain access to pre-deleted row column values.
    I did discover, however, that if the columns from the about-to-be-deleted row are used as inserts into another table, Oracle serves up a nasty-gram informing the user that values from the about-to-be-deleted table are unreliable.
    I was able to circumvent this constraint by assigning the about-to-be-deleted column values to local PL/SQL varables, then perform the insert using the variable values.
    -Bill McNamee
    NHDOT
    [email protected]

  • Cannot resize "Macintosh HD" after deleting second partition: OS 10.9.4

    I have partitioned my Macbook Pro in order to see if I could install Snow Leopard on one of the partitions, the main HD running Mavericks.
    Sadly, my late 2013 Mackbook Pro is not compatible with Snow Leopard (or at least I was unable to determine how to prepare the partition in order that the snow leopard install disc would run successfully).  At any rate, after this failed experiment, I deleted the partition I created for snow lion using disc utilities.  The problem I am having now is that I am unable to resize the single "partition" to the full size of the drive. I read this thread, Unable to delete second partition, and it suggests booting the mac in recovery mode in order to restore to a backed up version of the HD, however this is suggested as a work around for not being able to delete a partition, which is not my case.  Again, my problem is simply that once I have deleted the second partition, I am unable to have the single partition assume the full space of the drive.  Any suggestions short of a complete re-install?

    Here's the disc utilities snapshot after I deleted the partition that took up the space in the lower part of the quadrant.  I'd like the MacIntosh HD to subsume the space leftover by the deleted partition.
    a

  • New-Tab thumbnail screen freezes after deleting last thumbnail?

    Deletion of the last of the offered thumbnail choices can freeze that tab.
    Happens when using the new New Tab feature on Firefox v13.0.1, installed 6/17/12.
    I can still delete the entire New Tab screen and then start another.
    I am running Win XP+SP3 on an Acer Inspire One netbook with a 1024x600 screen. This seems to happen every time I try it. This morning's update informed me about this new feature, so I was trying it out.
    To reproduce:
    Click New-Tab and the 9 thumbnails almost fit the screen (pic1).
    I scroll down to see the bottom of the screen (pic2).
    I click the [X] to delete the bottom right thumbnail.
    The thumbnail images shift up a little, then the screen image freezes (pic3).
    I have screen images for pic1-pic3, if they might be useful.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Query not using index after delete?

    In 10 million table, i have purge a 5 millions and done table re-org, rebuilt of index and gather stats 100% including indexes.
    Query which is doing index scans eariler, now after purge explain plan has changed and its performing full table scan. Any idea, why behaviour has changed?
    its vendor based code can't change the query, any way to get back to index scan?

    Paulie wrote:
    Jonathan Lewis wrote:
    >
    I'm sure that Jonathan Lewis would not phrase it exactly like that, but in a nutshell, that's probably your answer.
    I certainly wouldn't phrase it like thatOf course not - I was merely poking fun at my rather simplistic and colloquial explanation - I certainly meant no
    offence.
    None taken (although perhaps I didn't make that clear enough -- I took your comment as tongue in cheek, anyway)
    >
    - and there definitely ISN'T a rule of thumb regarding proportion of data - Is it a common myth? I'm pretty sure that I have read about this "rule of thumb" to which I referred? I'll certainly
    take that on board in future.
    It is a very common myth - and one which various people have tried to dispel for years; unfortunately it gets resurrected fairly regularly by people who don't know any better. Critically, the choice of index is dictated by a combination of two factors, and mentioning one without the other is very misleading - the quantity of the data acquired and the scattering of the data. On top of that you have to remember that there are two "models" to consider - Oracle's estimate of quantity and scatter, and the actual quantity and scatter.
    >
    but the picture you're trying to invoke is probably the correct concept. We can safely assume that the
    re-organisation of the table has made it cheaper to use a brute-force method on the table (i.e. tablescan),
    and we can assume that he hasn't done anything to reduce the cost of the indexed access path in a
    similar way (and he may even have made it more expensive.) Well, that's a relief - I at least appear to be grasping the rudiments of the topic, in no small measure thanks
    to your chef d'oeuvre, Cost Based Oracle.
    Thanks
    Jonathan Lewis

  • BASIS SP 12 & 13 - Cannot logon using GUI after .....

    Hi,
    I am installing SAP XI 3.0 and as part of that I have installed the ABAP and Java WAS. I am applying SPs for the ABAP stack and I successfully applied the BASIS SPs 10 and 11(applied seperately). I was applying the SPs 12 and 13(together) and after running for some time the system crashed and I restarted the O/S and SAP to see that the SPs didn't go thru. Now when I try to log on using SAP GUI, it says "ABAP Runtime ERROR Error Code" which is blank and at the Bottom there is this message "Syntax Error in program SAPLSFES". I don't see the uid/pwd screen, where as I am able to connect to the Java system using the browser.
    Any Clue ?
    Help is appreciated. 
    Thanks.

    Hi,
    Thanks for the information provided on this thread.I was able to SOLVE the problem faced.
    I faced a similiar problem when applying SAPKB70014 and SAPKB70015 (BASIS).
    The import stopped at Patch level 14 and we had the same error in login screen : Error in SAPLSFES.
    We first checked the contents of table TRJOB and TRBAT at OS level by logging into the database. Both tables did not have any entries.
    the ULOG log file in /usr/sap/trans indicated the point where the import had failed.
    We then ran the
    tp showbuffer ER1 pf='/usr/sap/trans/TP_DOMAIN_SYSID.PFL' and checked for any running tp and R3trans processes.In our case , both jobs were not running.
    A check in dpmon did not reveal any kind of background job activity.
    After this we manually ran the tp command
    tp r3i SAPKB70014 <SYS-ID> pf=/usr/sap/trans/<TP_DOMAIN_SYSID.PFL 
    -Dclientcascade=yes -Dstoponerror=8 -Drepeatonerror=8 -Dsourcesystems= tag=spam
    This was completed without errors.
    We then tried login into SAPGUI. Again , we had the same error with SAPLSFES.
    We then did a showbuffer using
    tp showbuffer ER1 pf=/usr/sap/trans/TP_DOMAIN_SYSID.PFL and it showed that only SAPKB700015 was left to be imported.
    We again manually ran tp r3i for patch 15 as well.
    This step took some time (have some patience !!) , and after that the import was successfully finished with error level 4.
    We then tried login into SAPGUI and it worked for us.
    Hope this information helped.
    - Mahesh
    Edited by: mahesh chedde on Jun 7, 2008 2:13 PM
    Edited by: mahesh chedde on Jun 7, 2008 2:14 PM

  • Use of "DBA_OBJECTS" in "AFTER CREATE" Trigger

    Hi,
    We would like to store some extra information about our objects we have in the database. To do so we tought of the idea of creating a 'documenting' table containing an object_id that references to the object_id from the view dba_views.
    Now we want to automatically create a new record in our documenting table when a new object is created, in the first stage this should only contain the object_id
    To accomplish this we are using an 'AFTER CREATE' trigger, but when this trigger fires and the code searches for the new object_id in dba_objects, it does not return any records and generates an error. Likely because when the trigger is executed, the view is not yet updated?
    create or replace
    TRIGGER TRG_TEST
    AFTER CREATE ON SCOTT.SCHEMA
    DECLARE
    tmp VARCHAR2(50);
    BEGIN
    dbms_output.put_line(ora_dict_obj_name);
    select object_id
    into tmp
    from dba_objects
    where object_name = ora_dict_obj_name;
    dbms_output.put_line(tmp);
    END;
    Error report:
    ORA-04088: Fout bij uitvoering van trigger 'SCOTT.TRG_TEST'.
    ORA-01403: Geen gegevens gevonden.
    ORA-06512: in regel 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    It's in dutch, so I'll have a go at translating:
    Error report:
    ORA-04088: Exception while executing trigger 'SCOTT.TRG_TEST'.
    ORA-01403: No data found
    ORA-06512: in rule 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    Does anyone have an idea of how I can accomplish what I'm trying to do here.. Or maybe something I'm doing wrong?
    Thanks in advance!
    Davy

    What is "ora_dict_obj_name" defined as?
    Another option might be to setup a DBMS_SCHEDULER job to run the following insert
    firstly though, create the following table ;
    create document_table as (select * from dba_objects where rownum < 1)and then setup a DBMS_SCHEDULER job to run the following:
    begin
      insert into document_table
      (select dbo.*
       from   dba_objects    dbo
             ,document_Table dtb
       where  dbo.Object_ID = dtb.Object_ID(+)
       and    dtb.Object_ID is null);
       commit;
       exception
        when others then
          rollback;
          -- log a message somewhere with the error, i.e. SQLERRM
    end;
    /Note, I specified all columns, but you'll probably specify explicitly which column you require, in which case the CREATE table would change as well.
    Then you won't have a need for any trigger, and can better manage when you want your documentation to be updated.
    Another option might be to use COMMENT, which can be used on tables, views, materialized views, but won't cover all objects
    to the extent you might want.
    SQL> desc emp2
    Name                                                                                                  
    EMPNO                                                                                                 
    JOB                                                                                                   
    START_DATE                                                                                            
    SAL                                                                                                   
    DEPT                                                                                                  
    END_DATE                                                                                              
    SQL> comment on column emp2.sal is 'Existing Salary of employee as paid at most recent month end';

  • After insert trigger with :NEW.ROWID

    Hi All,
    I am using a After insert trigger to generate history record as following:
    CREATE TABLE TB_TEST (classID number(3), classNm varchar2(12));
    CREATE TABLE TB_HIST_TEST (hist_dttm timestamp(6), classID number(3), classNm varchar2(12));
    CREATE or REPLACE TRIGGER air_test AFTER INSERT ON tb_test FOR EACH ROW
    BEGIN PK_SRVC.CRT_NewRec('TB_TEST', 'TB_HIST_TEST', :new.ROWID); END:
    In PK_SRVC package, I use the following statment to create new record in TB_HIST_TABLE:
         Insert into tb_hist_test (hist_dttm, classID, classNm)
         values (select systimestamp, classID, classNm from tb_test where rowid = ROWID )
    The trigger DOES fire when a new row is inserted into TB_TEST. However there is no record inserted into TB_HIST_TEST. Any suggestion?
    Thanks,

    The PK_SRVC.CRT_NewRec is a generic service package that can be shared by many tables. It uses dynamic SQL to get all the collumns for different tables based on USER_TAB_COLUMNS.  The following is the code of this package:
    PROCEDURE CRT_NewRec ( p_TableName IN VARCHAR2, p_AudTableName IN VARCHAR2, p_RowID)
    IS
           TYPE TabCol_RecTyp IS RECORD (COLUMN_NAME VARCHAR2(30), COLUMN_ID NUMBER);
           TYPE TabCol_CurTyp IS REF CURSOR;
            c_TabCol TabCol_CurTyp;
            rc_TabCol TabCol_RecTyp;
            v_Sql_TabCol VARCHAR2(1000);
            v_ColNames VARCHAR2(1000);
            v_Sql VARCHAR2(1000);
            PRAGMA AUTONOMOUSE_TRANSCATION;
    BEGIN
            v_SQL_TabCol := ' SELECT column_name, column_id FROM USER_TAB_COLUMNS'
                                      ||  ' WHERE table_name = ' || CHR(39) || p_TableName || CHR(39)
                                      || '  ORDER BY column_id';
            v_ColNames := NULL;
            OPEN c_TabCol FOR v_Sql_TabCol;
            Loop
                   FETCH c_TabCol INTO rc_TabCol; Exit WHEN c_TabCol%NOTFOUND:
                   v_ColNames := v_ColNames || ',' || rc_TabCol.COLUMN_NAME;
            End Loop;
            CLOSE c_TabCol;
            v_Sql := 'INSERT INTO ' || p_AudTableName || '(HIST_DTTM, ' || v_ColNames || ' )'  
                      || ' SELECT systimestamp, ' || v_ColNames || ' FROM ' || p_TableName
                      || ' WHEN ROWID = chartorowid(' || CHR(39) || p_RowId || CHR(39) || ')';
             EXECUTE IMMEDIATE v_Sql;
             COMMIT;
    END;    
    (charmingholidays-yyz)

  • After Update Trigger executes twice when single row is uptd thro proc

    We have the below trigger in our db. When a single record is updated using a procedure the trigger is executed twice and it inserts two records in other table.
    But when i issue an update statement using any sql client tool it is executing only once and inserts only one record in other table.
    Can any one please help me to find the reason?
    Trigger:*
    create or replace TRIGGER CX_HEADER_ESCL_T1 AFTER UPDATE OF STATUS ON CX_HEADER
    FOR EACH ROW
    DECLARE
    "b1-CTRIYJ" boolean := FALSE;
    BEGIN
    IF UPDATING('STATUS') AND(:NEW.status = 'SUCCESS') THEN
    "b1-CTRIYJ" := TRUE;
    END IF;
    IF "b1-CTRIYJ" = TRUE THEN
    INSERT
    INTO siebel.s_escl_req(req_id, created, bt_row_id, rule_id, tbl_name, created_by, group_id)
    VALUES('11111111', CURRENT_DATE, :NEW.row_id, '1-CTRIYJ', 'CX_HEADER', :NEW.last_upd_by, '1-2CU3');
    "b1-CTRIYJ" := FALSE;
    END IF;
    END;
    Procedure:
    CREATE OR REPLACE
    PROCEDURE CLOSE_BATCH
    (ChildRecordCount IN NUMBER, HeaderId IN VARCHAR2, CompletionStatus OUT VARCHAR2) AS
    CafeChildCount NUMBER;
    BEGIN
    select count(*) into CafeChildCount from SIEBEL.CX_CHILD where HEADER_ID=HeaderId;
    IF ChildRecordCount = CafeChildCount THEN
    update SIEBEL.CX_HEADER set STATUS ='SUCCESS', MODIFICATION_NUM = MODIFICATION_NUM+1 where HEADER_ID=HeaderId;
    CompletionStatus := 'SUCCESS';
    ELSE
    update SIEBEL.CX_CHILD set STATUS='FAILED' where HEADER_ID=HeaderId;
    update SIEBEL.CX_HEADER set STATUS='FAILED' where HEADER_ID=HeaderId;
    CompletionStatus := 'FAILED';
    END IF;
    commit;
    /*CompletionStatus := 'SUCCESS';*/
    EXCEPTION
    WHEN OTHERS THEN
    CompletionStatus := SQLCODE;
    rollback;
    END;

    Your problem seems not be related to the trigger restart issue I have already mentioned because you are using a AFTER UPDATE trigger and not a BEFORE UPDATE trigger:
    >
    BEFORE Triggers Fired Multiple Times
    If an UPDATE or DELETE statement detects a conflict with a concurrent UPDATE, then Oracle Database performs a transparent ROLLBACK to SAVEPOINT and restarts the update. This can occur many times before the statement completes successfully. Each time the statement is restarted, the BEFORE statement trigger is fired again. The rollback to savepoint does not undo changes to any package variables referenced in the trigger. Your package should include a counter variable to detect this situation.
    >
    If you are sure that you update a single row and that your trigger fires twice and if you can easiily reproduce the issue, I recommend that you contact Oracle Support and create a Service Request for your issue that could be an Oracle bug.

Maybe you are looking for

  • Dunning letters run automatically on a weekly basis

    Hi Expert, Is it possible to make the dunning letters run automatically on a weekly basis? If the answer is yes, then what config do we need to run the report on wekkly basis or what are the steps. Please let me know in very details, because, I am no

  • Isse with using Grouping Sets in SQL Server 2008 R2

    Hi, I created a query in SQL Server 2012 using grouping sets that works fine.  When I try to use the same query in SQL Server 2008 I get an error ("Inccorrect syntax near SETS"). I researched using grouping sets in 2008 and didn't see any issue with

  • Returning Demaged Material and getting new Material free of Cost

    Dear Experts As per my sceneriao ,one of our Bearing is got demaged and we told to vendor for the replaement.Once replacemnt is recived we will send back demaged material what is correct Cycle for this. Regards Raj

  • Import events from another iPhoto library?

    I recently went on vacation, and took my laptop with. During the trip I downloaded the photos from our camera's SD cards, but did not delete the photos, so we had a backup on the laptop and on the cameras. The events came in with no issues to the lap

  • How to resolve hostname in Common Service 3.3 ?

    hi guys! i have a problem when discover my devices in ciscoworks common service 3.3. i discovered use module setting cdp and ping sweep , preferred dcr name is hostname, and update dcr display name is checked. i hope the hostname is show in display n