Capturing value in after insert or update row level trigger

Hi Experts,
I'm working on EBS 11.5.10 and database 11g. I have trigger-A on wip_discrete_jobs table and trigger-B on wip_requirement_operations table.When ever i create discrete job, it inserts record in both wip_discrete_jobs and wip_requirement_operations.
Note:2 tables are like master-child relation.
Trigger-A: After Insert.Row Level trigger on wip_discrete_jobs
Trigger-B:After Insert,Row Level trigger on wip_requirement_operations
In Trigger A:
I'm capturing wip_entity_id and holding in global variable.
package.variable:=:new.wip_entity_id
In Trigger B:
I'm using the above global variable.
Issue: Let's say i have create discrete job,it's wip_entity_id is 27, but the global variable is holding the previous wip_entity_id(26),not current value.It looks like before trigger A event is complete, trigger B is also in process, i think this could be the reason it's not storing the current wip_entity_id in the global variable.
I need your help how to have the current value in the global variable so that i can use that in the trigger B.
Awaiting response at the earliest.
Thanks

798616 wrote:
Hi Experts,
I'm working on EBS 11.5.10 and database 11g. I have trigger-A on wip_discrete_jobs table and trigger-B on wip_requirement_operations table.When ever i create discrete job, it inserts record in both wip_discrete_jobs and wip_requirement_operations.
Note:2 tables are like master-child relation.
Trigger-A: After Insert.Row Level trigger on wip_discrete_jobs
Trigger-B:After Insert,Row Level trigger on wip_requirement_operations
In Trigger A:
I'm capturing wip_entity_id and holding in global variable.
package.variable:=:new.wip_entity_id
In Trigger B:
I'm using the above global variable.
Issue: Let's say i have create discrete job,it's wip_entity_id is 27, but the global variable is holding the previous wip_entity_id(26),not current value.It looks like before trigger A event is complete, trigger B is also in process, i think this could be the reason it's not storing the current wip_entity_id in the global variable.
I need your help how to have the current value in the global variable so that i can use that in the trigger B.
Awaiting response at the earliest.
ThanksMy head hurts just thinking about how this is being implemented.
What's stopping you from creating a nice and simple procedure to perform all this magic?
Continue with the global/trigger magic at your own peril, as you can hopefully already see ... nothing good will come from it.
Cheers,

Similar Messages

  • After update row level trigger help

    Hello,
    I have to update some data on a table. I need to be able to undo the update just in case something goes wrong after update is comitted. I decided to keep track of updated rows by inserting new and old values on a audit table using UPDATE ROW LEVEL trigger. Everything working fine as I wished, but here is what I am having a problem in separating each bulk of update by a unique ID... I am not talking about any primary key or autogenerated sequence key here.
    Audit table inserts values: primary key of table, old value before update, new value after update, and time stamp. Now, I want add one more field on the audit table that indentifies each bulk of UPDATE operation... I tried to use session ID, it works fine, but sometimes I may update two or three times, maybe around same time, on the same day from the same session (timestamp doesn't help me). In that case, each UPDATE operation inserts the same session ID on Audit table. I won't know which update operation populated which row of the audit table.
    Can somebody give me how I can resolve this situation. Again, this has to be inside the trigger. Is there any other IDs that I can use? I would appreciate your help. Thanks,

    Can you add a table level trigger in addition to your row level trigger? If so, you could do what you want in there. In the new trigger, formulate a unique value (such as session id || sysdate) and store it using dbms_application_info.set_module and set the MODULE to that value. Then, in your row level trigger code, execute dbms_application_info.read_module and pull the MODULE value and insert it into your audit table.
    The use of session id || sysdate should be fine (and unique) in this context. You'd just have to know at what time the UPDATE batch occurred that you wanted to undo.
    By the way, you could use LogMiner to do what I think you're trying to create with the use of your trigger code and table entries. Recall the Oracle keeps the undo and redo data for every row that is updated in the redo/archive logs. Using LogMiner, you could find and undo any change from any time. Just like your method, you'd have to know when the "bad" thing occurred in order to find the correct log and "mine" it, but all the functionality is there. There's a kinda old, but very good, article by Arup Nanda at http://www.oracle.com/technology/oramag/oracle/05-jul/o45dba.html that reviews how it all works. You may want to look at it to see if you can avoid re-inventing the wheel to meet your needs. Just a thought....
    Karen

  • SQL merge and after insert or update on ... for each row fires too often?

    Hello,
    there is a base table, which has a companion history table
    - lets say USER_DATA & USER_DATA_HIST.
    For each update on USER_DATA there has to be recorded the old condition of the USER_DATA record into the USER_DATA_HIST (insert new record)
    - to have the history of changes to USER_DATA.
    The first approach was to do the insert for the row trigger:
    trigger user_data_tr_aiu after insert or update on user_data for each rowBut the performance was bad, because for a bulk update to USER_DATA, there have been individual inserts per records.
    So i tried a trick:
    Instead of doing the real insert into USER_DATA_HIST, i collect the USER_DATA_HIST data into a pl/sql collection first.
    And later i do a bulk insert for the collection in the USER_DATA_HIST table with stmt trigger:
    trigger user_data_tr_ra after insert or update on user_dataBut sometimes i recognize, that the list of entries saved in the pl/sql collection are more than my USER_DATA records being updated.
    (BTW, for the update i use SQL merge, because it's driven by another table.)
    As there is a uniq tracking_id in USER_DATA record, i could identify, that there are duplicates.
    If i sort for the tracking_id and remove duplicate i get exactly the #no of records updated by the SQL merge.
    So how comes, that there are duplicates?
    I can try to make a sample 'sqlplus' program, but it will take some time.
    But maybe somebody knows already about some issues here(?!)
    - many thanks!
    best regards,
    Frank

    Hello
    Not sure really. Although it shouldn't take long to do a test case - it only took me 10 mins....
    SQL>
    SQL> create table USER_DATA
      2  (   id      number,
      3      col1    varchar2(100)
      4  )
      5  /
    Table created.
    SQL>
    SQL> CREATE TABLE USER_DATA_HIST
      2  (   id      number,
      3      col1    varchar2(100),
      4      tmsp    timestamp
      5  )
      6  /
    Table created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE pkg_audit_user_data
      2  IS
      3
      4      PROCEDURE p_Init;
      5
      6      PROCEDURE p_Log
      7      (   air_UserData        IN user_data%ROWTYPE
      8      );
      9
    10      PROCEDURE p_Write;
    11  END;
    12  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY pkg_audit_user_data
      2  IS
      3
      4      TYPE tt_UserData        IS TABLE OF user_data_hist%ROWTYPE INDEX BY BINARY_INTEGER;
      5
      6      pt_UserData             tt_UserData;
      7
      8      PROCEDURE p_Init
      9      IS
    10
    11      BEGIN
    12
    13
    14          IF pt_UserData.COUNT > 0 THEN
    15
    16              pt_UserData.DELETE;
    17
    18          END IF;
    19
    20      END;
    21
    22      PROCEDURE p_Log
    23      (   air_UserData        IN user_data%ROWTYPE
    24      )
    25      IS
    26          ln_Idx              BINARY_INTEGER;
    27
    28      BEGIN
    29
    30          ln_Idx := pt_UserData.COUNT + 1;
    31
    32          pt_UserData(ln_Idx).id     := air_UserData.id;
    33          pt_UserData(ln_Idx).col1   := air_UserData.col1;
    34          pt_UserData(ln_Idx).tmsp   := SYSTIMESTAMP;
    35
    36      END;
    37
    38      PROCEDURE p_Write
    39      IS
    40
    41      BEGIN
    42
    43          FORALL li_Idx IN INDICES OF pt_UserData
    44              INSERT
    45              INTO
    46                  user_data_hist
    47              VALUES
    48                  pt_UserData(li_Idx);
    49
    50      END;
    51  END;
    52  /
    Package body created.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER preu_s_user_data BEFORE UPDATE ON user_data
      2  DECLARE
      3
      4  BEGIN
      5
      6      pkg_audit_user_data.p_Init;
      7
      8  END;
      9  /
    Trigger created.
    SQL> CREATE OR REPLACE TRIGGER preu_r_user_data BEFORE UPDATE ON user_data
      2  FOR EACH ROW
      3  DECLARE
      4
      5      lc_Row      user_data%ROWTYPE;
      6
      7  BEGIN
      8
      9      lc_Row.id   := :NEW.id;
    10      lc_Row.col1 := :NEW.col1;
    11
    12      pkg_audit_user_data.p_Log
    13      (   lc_Row
    14      );
    15
    16  END;
    17  /
    Trigger created.
    SQL> CREATE OR REPLACE TRIGGER postu_s_user_data AFTER UPDATE ON user_data
      2  DECLARE
      3
      4  BEGIN
      5
      6      pkg_audit_user_data.p_Write;
      7
      8  END;
      9  /
    Trigger created.
    SQL>
    SQL>
    SQL> insert
      2  into
      3      user_data
      4  select
      5      rownum,
      6      dbms_random.string('u',20)
      7  from
      8      dual
      9  connect by
    10      level <=10
    11  /
    10 rows created.
    SQL> select * from user_data
      2  /
            ID COL1
             1 GVZHKXSSJZHUSLLIDQTO
             2 QVNXLTGJXFUDUHGYKANI
             3 GTVHDCJAXLJFVTFSPFQI
             4 CNVEGOTDLZQJJPVUXWYJ
             5 FPOTZAWKMWHNOJMMIOKP
             6 BZKHAFATQDBUVFBCOSPT
             7 LAQAIDVREFJZWIQFUPMP
             8 DXFICIPCBCFTPAPKDGZF
             9 KKSMMRAQUORRPUBNJFCK
            10 GBLTFZJAOPKFZFCQPGYW
    10 rows selected.
    SQL> select * from user_data_hist
      2  /
    no rows selected
    SQL>
    SQL> MERGE
      2  INTO
      3      user_data a
      4  USING
      5  (   SELECT
      6          rownum + 8 id,
      7          dbms_random.string('u',20) col1
      8      FROM
      9          dual
    10      CONNECT BY
    11          level <= 10
    12  ) b
    13  ON (a.id = b.id)
    14  WHEN MATCHED THEN
    15      UPDATE SET a.col1 = b.col1
    16  WHEN NOT MATCHED THEN
    17      INSERT(a.id,a.col1)
    18      VALUES (b.id,b.col1)
    19  /
    10 rows merged.
    SQL> select * from user_data_hist
      2  /
            ID COL1                 TMSP
             9 XGURXHHZGSUKILYQKBNB 05-AUG-11 10.04.15.577989
            10 HLVUTUIFBAKGMXBDJTSL 05-AUG-11 10.04.15.578090
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - ProductionHTH
    David

  • AFTER INSERT OR UPDATE TRIGGER the insert not working

    The update works but the insert is not working. I have two version that I have tried. I amd executing the inserts/update from Oracle Applications and the table row is either being inserted or updated correctly.
    DROP TRIGGER APPS.CCC_HZ_ORG_CONTACTS_ARU;
    CREATE OR REPLACE TRIGGER APPS.CCC_HZ_ORG_CONTACTS_ARU
    /* --Created By: SKELLEHER
    --Creation Date: 07/15/09
    --Last Updated By:
    --Last Update Date:  
    AFTER INSERT OR UPDATE OF department, job_title
    ON apps.hz_org_contacts
    FOR EACH ROW
    WHEN (
    NEW.department <> OLD.department OR
    NEW.job_title <> OLD.job_title
    DECLARE
    v_ChangeType VARCHAR2(10);
    BEGIN
    /* Use 'I' for Insert, 'U'' for Update, and'D' for delete(not part of app at this time). */
    IF INSERTING THEN
    v_ChangeType := 'INSERT';
    ELSIF UPDATING THEN
    v_ChangeType := 'UPDATE';
    ELSE
    v_ChangeType := 'DELETE';
    END IF;
    INSERT INTO cust.ccc_tca_po_tf_event_tbl
    VALUES (ccc_tca_po_tf_event_tbl_s.NEXTVAL
    , 'hz_org_contacts'
    , v_ChangeType
    , 'org_contact_id'
    , :NEW.org_contact_id
    , 'PENDING'
    , NULL
    , 0
    , 'N'
    , 'Y'
    , :NEW.LAST_UPDATED_BY
    , :NEW.LAST_UPDATE_DATE
    , -1
    , SYSDATE
    , 'DEPARTMENT_JOBTITLE_UPDATE'
    ,'LDAP'
    END;
    AND I TRIED ANOTHER VERSION:

    I have simplified it so it's just checking for insert but it's not picking up. Is the syntax IF INSERTING correct?
    CREATE OR REPLACE TRIGGER APPS.CCC_HZ_ORG_CONTACTS_ARU
    AFTER INSERT OR UPDATE
    ON ar.hz_org_contacts
    FOR EACH ROW
    DECLARE
    BEGIN
    IF INSERTING THEN
    INSERT INTO cust.ccc_tca_po_tf_event_tbl
    VALUES (ccc_tca_po_tf_event_tbl_s.NEXTVAL
    , 'hz_org_contacts'
    , 'UPDATE'
    , 'org_contact_id'
    , :NEW.org_contact_id
    , 'PENDING'
    , NULL
    , 0
    , 'N'
    , 'Y'
    , :NEW.LAST_UPDATED_BY
    , :NEW.LAST_UPDATE_DATE
    , -1
    , SYSDATE
    , 'DEPARTMENT_JOBTITLE_UPDATE'
    ,'LDAP'
    END IF;
    END;
    /

  • Row level trigger updating the entire table instead of affected rows

    I am using orace 8.1.7. My problem is I have a row level trigger that should fire only once ( and insert a row in my auditing table). But it is doing it for the entire table. This only happens when I have more than two columns in an Update clause. Has anyone run into this problem before. Any help would be highly appreciated.
    thanks,
    dinesh

    create or replace trigger contact_audit
    before update or delete on contact
    for each row
    declare
    v_audit_type char(1);
    v_audit_item varchar2(64) := 'CONTACT';
    v_acct_seqid number;
    Begin
    if inserting then
         v_audit_type := 'I';
    elsif updating then
    v_audit_type := 'U';
    elsif deleting then
    v_audit_type := 'D';
    end if;
    select acct_seqid into v_acct_seqid
    from account_contact
    where email = :old.contact_email;
    insert into audit_event ( id, audit_item, audit_type, audit_date, acct_seqid, col_1, col_2, col_3, col_4, col_5, col_6, col_7, col_8,
    col_9, col_10, col_11, col_12, col_13, col_14, col_15, col_16, col_17, col_18, col_19, col_20)
    values (audit_event_sq.nextval, v_audit_item, v_audit_type, sysdate, v_acct_seqid, :old.contact_email, :old.contact_type, :old.contact_last, :old.contact_first,
    :old.title, :old.address1, :old.address2, :old.address3, :old.city, :old.state, :old.zip_code5, :old.zip_code4, :old.zip_code_barcode, :old.country, :old.phone_no,
    :old.phone_ext, :old.receive_info_email_yn, :old.pwd_encrypted, :old.pwd_question, :old.pwd_answer);
    End;

  • Getting iteration number in row level trigger

    Hi. Is there a way to get iteration number in row level trigger? Or to access data inserted in statement level trigger from row level trigger (statement level trigger are supposed to be executed before row level triggers but I cannot access them).
    I'm using Oracle 10g.

    My oracle version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    And business problem is like this:
    I need to have two log tables for some tables in my database:
    First log table is a statement level log. After insert or update or delete it should get one new row with mentioning date, time, sid, query type and some additional information.
    Second table should include all columns from table logged, date, time, sid and operation type.
    The problem is, I need exact the same date and time for each row in both log tables.
    Someone said that sysdate should return same value for query execution time. But it have nothing to do with triggers fired on this query.
    So you may say that I'm curious about getting exact same date and time for one statement level trigger and for each execution of row level trigger.

  • After insert or update calculate column

    question about a table.
    I have a table called table1
    AFTER data is inserted or updated into the table1
    I want to run an update on the same table (table1) with a case statement
    update table1
    set column2 = case
    WHEN column1 = 'abc' THEN 'testl'
    WHEN column1 = 'def' THEN 'test2'
    ELSE 'test3'
    END;
    commit;
    END;
    i cant use a trigger because i get error since the insert would be on same table.
    What else can i use for this update ? I cant use a stored procedure that runs daily or something like that because the column2 in the table needs to be populated immediately after an insert or update
    thanks for any ideas

    SQL>  CREATE TABLE TABLE1
      2  (
      3    COLUMN1 VARCHAR2(10),
      4    COLUMN2 VARCHAR2(10)
      5  );
    Table created.
    SQL> CREATE OR REPLACE TRIGGER TRG_TABLE1
      2  BEFORE INSERT OR UPDATE OF COLUMN1 ON TABLE1
      3  FOR EACH ROW
      4  BEGIN
      5
      6  IF :NEW.COLUMN1 = 'abc' THEN
      7     :NEW.COLUMN2 := 'test1';
      8  ELSIF :NEW.COLUMN1 = 'def' THEN
      9     :NEW.COLUMN2 := 'test2';
    10  ELSE
    11     :NEW.COLUMN2 := 'test3';
    12  END IF;
    13
    14  END;
    15  /
    Trigger created.
    SQL> INSERT INTO TABLE1(COLUMN1) VALUES('abc');
    1 row created.
    SQL> SELECT * FROM TABLE1;
    COLUMN1    COLUMN2
    abc        test1
    SQL> UPDATE TABLE1 SET COLUMN1 = 'def';
    1 row updated.
    SQL> SELECT * FROM TABLE1;
    COLUMN1    COLUMN2
    def        test2
    SQL>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Reset Field Sequence Value based on Insert OR update on that field

    Hi Experts,
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> WITH TAB AS
      2  (
      3      SELECT 1 ID,2 SEQ FROM DUAL UNION ALL
      4      SELECT 2 ID,1 SEQ FROM DUAL UNION ALL
      5      SELECT 3 ID,4 SEQ FROM DUAL UNION ALL
      6      SELECT 4 ID,3 SEQ FROM DUAL
      7  )SELECT * FROM TAB ORDER BY SEQ
      8  ;
            ID        SEQ
             2          1
             1          2
             4          3
             3          4
    SQL>If i insert or update any of the existing field (SEQ) value, the other values in the field (SEQ) has to
    be resetted, like
    INSERT INTO TAB VALUES(5,1);
    Expected Result:
            ID        SEQ
          5         1     
             2          2
             1          3
             4          4
             3          5
    SQL>
    How can i achieve this?
    Thanks,

    looks like you might be looking for a custom sequence manager.
    you might want to consider using a trigger to do this.
    unfortunately if you use just one trigger you will probably get a mutating exception.
    so you may need to do a multiple trigger approach
    make a place to hold the rows you want to look at
    i called mine tad_mgr
    CREATE OR REPLACE PACKAGE TAD_MGR IS
    *  This package spec holds the row ids of the tad table to be  used in the 3 trigger approach
    type ridArray is table of tab.ID%type index by binary_integer;
    newRows ridArray;
    empty ridArray;
    END;
    /your 1st trigger clears out any left over rows you have.
    CREATE OR REPLACE TRIGGER TAB_1ST
        before INSERT  of ID ON TAB
    declare
    *  This is the 1st trigger in 3 trigger approach to manage seq cds on the tad table
    begin
                    TAD_MGR.newRows :=  TAD_MGR.empty;
    end;
    /your second triggers puts your new or updated row into the container
    CREATE OR REPLACE TRIGGER TAB_2ND
    BEFORE INSERT
    OF ID ON TAB  REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    declare
    This is the 2nd trigger in 3 trigger approach to manage seq cds on the tad table
    begin
                 TAD_MGR.newRows( TAD_MGR.newRows.count+1 ) := :new.id;
    end;
    /finally your last trigger does the updates.
    CREATE OR REPLACE TRIGGER TAB_3RD
    AFTER INSERT OF ID ON TAB
    declare
    This is the 3RD trigger in 3 trigger approach to manage seq cds on the tad table
    aSEQ  tab.seq%type;
    aId   tab.id%type;
    begin
      for i in 1 ..TAD_mgr.newRows.count loop
        select ID, SEQ into aId, aSeq from tab where id = taD_mgr.newRows(i);
        for c in (select  id, seq  FROM tab where seq >= aSeq and id != aid ) loop
            update tab
            set seq = c.seq + 1
            where id = c.id;
        end loop;
    end loop;
               taD_mgr.newRows := taD_mgr.empty;
       end;
    /I just did this for the insert just as an example but you can change the triggers to insert or update and change the logic accordingly
    Edited by: pollywog on Apr 12, 2010 7:14 AM

  • Before and After insert or update rowcount

    Hi
    I have several extract objects procs which are calling various build objects procs which in turn are inserting or updating the tables...now when i run these objects sometimes i get no errors and everything seems to be running perfectly but the tables do not get updated ? now what i am trying to achieve here is get some kind of summary where i can see the before and after rowcount..for that i have created a table of every extract object proc and another table with the coressponding tables being updated by tht proc...can anyone pls tell me how should i look into these procs and how do i get the rowcount for a particular table before and after the procedure was run ?
    Thanks a lot in advance

    Hi,
    On which version of RDBMS are you working , because if you're on 10g then just enable auditing or even FGA on the tables were you want to see the changes,
    Then query the DBA-AUDIT (not sure of the name anymore) view.
    If not then create a audit package yourself.
    something like
    create or replace package pck$audit as
    procedure prc$check_tablecount(p_tablename IN VARCHAR2, p_status IN VARCHAR2);
    end;
    create or replace package body pck$audit as
    procedure prc$check_tablecount(p_tablename IN VARCHAR2,p_status IN VARCHAR2) IS
    sqlstr VARCHAR2(100);
    v_count NUMBER;
    begin
    sqlstr := 'SELECT COUNT(*) FROM '||p_tablename;
    EXECUTE IMMEDIATE sqlstr into v_count; --could by 'using v_count' check syntax for this
    INSERT INTO audit_table(table_name,total_count,status,time_stamp)
    VALUES(p_tablename,v_count,p_status,SYSTIMESTAMP);
    COMMIT;
    end;
    end;
    you can elaborate on this creating additional procedure checking differences in total_count on same table at same time.
    Now call this procedure before starting your insert-delete- on your table make sure you put the parameters correct eg p_status => 'begin procedure'
    and call it again after your commit in your procedure.
    Hope this helps you out
    Erwin

  • AFTER INSERT OR UPDATE TRIGGER

    All of my tables have a dateTime field which is used to track when a record was inserted/updated. I would like a trigger on each table that updates the dateTime field with the current date and time after each insert or update. I keep getting a mutating error and I can't quit wrap my brain around how to fix it. Could anyone provide a example.
    I know I am getting the error because I am trying to update the row that is currently being inserted or updated - what is the best way to handle this?
    Thanks

    Hi,
    A trigger before insert or update is better for your case :
    For example :
    SQL> desc tab_param
    DELAI_RETENTION_FLUX NOT NULL NUMBER(5)
    DATE_DEBUT_ALARME NOT NULL DATE
    DATE_DEBUT_HITSTORIQUE NOT NULL DATE
    NB_FLUX_TOTAL NOT NULL NUMBER(5)
    NB_FLUX_PAGE NOT NULL NUMBER(5)
    DATE_COL DATE
    CREATE OR REPLACE TRIGGER TEST_TRG BEFORE INSERT OR
    UPDATE OF DATE_DEBUT_ALARME, DATE_DEBUT_HITSTORIQUE,
    DELAI_RETENTION_FLUX, NB_FLUX_PAGE, NB_FLUX_TOTAL
    ON TAB_PARAM REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    begin
    :new.date_col:=sysdate;
    end;
    Nicolas.

  • Need to raise Business Event after insert or updates on a table

    Hi All,
    Requirement : I have a Custom table in Oracle E-biz (R12 using 11g database), Whenever any row is inserted or updated on this Custom table, I need to log this changes in an audit table and then raise a Business event.
    Please suggest which are the best possible options.
    I could sense few options like
    1. Using Oracle Alerts (Event)
    2. Using Triggers
    Thanks,
    Santhosh

    Thanks for the response.
    Let me look into the links which you have sent.
    Meanwhile i have few clarifications as given below:
    1. If i use triggers, the trigger fires before the transaction is committed.
    2. If i use event alerts, i see some delay in the alert firing. I tried creating a separate concurrent program for "Check event alert". But still i dont see any improvement.
    Any suggestions on this ..?
    Thanks,
    Santhosh

  • Confirmations after SRM Server update to level 9

    We are having an issue with regards to Confirmation of goods, we have a po of 300 units and we have confirmed 85 but this has failed there is no figures in the confirmed Qty nor is there a value.
    Any ideas?

    We resolced this by checking the PORT in EDI (WE21) rfc connections where incorrect

  • Problems with row level trigger.

    Hi there. I'm trying to create a trigger for a table ... it's an attempt to audit all changes made to the table data. I'm getting an error message however, for my new and old interviewdate. The specific message is:
    Error(12,92): PLS-00049: bad bind variable 'NEW.INTERVIEWDATE'
    Error(12,72): PLS-00049: bad bind variable 'OLD.INTERVIEWDATE'
    here's the code:
    CREATE OR REPLACE TRIGGER AUDITCHANGES
    BEFORE INSERT OR DELETE OR UPDATE
    ON WTB
    FOR EACH ROW
    DECLARE
    BEGIN
    IF :new.InterviewDate != :old.InterviewDate THEN
    INSERT INTO WITAudit (DTCHG,FLDNAME, userid, oldval, newval)
    VALUES (SYSDATE, “InterviewDate”, SYS_CONTEXT('USERENV','OS_USER'),:old.InterviewDate, :new.InterviewDate);
    END IF;
    END;
    Can you point me in the right direction?
    Thanks.

    Remove the DOUBLE quotes from this “InterviewDate”. ..
    try posting your code in between tags
    &#123;code}
    select....
    &#123;code}
    SS                                                                                                                                                                                                                                                                                                                   

  • Execution of Row level trigger in Oracle Streams.

    Hi All,
    Oracle Database version : 9.2.0.4 on windows NT/2000 environment.
    We managed to install,configure oracle stream technologies.
    Oracle Stream seems to be working fine for replication of DML & DDL changes from source database to target database.
    Following is detail at source end.
    Source Sid = acc
    Source Schema = stream
    Source Table = dept
    structure of dept table.
    Name Null? Type
    DEPTNO NOT NULL NUMBER(5)
    DNAME NOT NULL VARCHAR2(10)
    LOC NOT NULL VARCHAR2(10)
    Streamadmin user = strmadmin
    Following is detail at target end.
    Target Sid = fin
    Target Schema = stream
    Target Table = dept
    structure of dept table.
    Name Null? Type
    DEPTNO NOT NULL NUMBER(5)
    DNAME NOT NULL VARCHAR2(10)
    LOC NOT NULL VARCHAR2(10)
    TRAN_DATE                    NULL DATE DEFAULT SYSDATE
    I checked on insert/update/delete of rows into dept table at source database, changes are correctly replicated to target table dept.
    I wrote a simple trigger which is as follows on dept table at target database.
    create or replace trigger dept_upd_del
    before delete or update of dname,loc on stream.dept
    for each row
    begin
    dbms_output.put_line('Inside Trigger');
    if updating then
    dbms_output.put_line('Update');     
    insert into stream.dept_change values (:old.deptno,'U',sysdate);
    end if;
    if deleting then
    dbms_output.put_line('Delete');
    insert into stream.dept_change values (:old.deptno,'D',sysdate);
    end if;
    end;
    I expect this trigger to get executed whenever changes occurs into dept table at target database whenever dml changes are propagated from source to target table. However i found that the above trigger is not executed at all.
    I was further surprised, since incase i update/delete rows from target table dept the above trigger is executing correctly.
    Can someone please let me know about this?
    I believe stream technology is using INSERT / UPDATE & DELETE statement when changes are applied at target table but this doesn't seems to be the case.
    Thanks in Advance.
    Regards,
    Vidyanand

    The trigger at the destination will not fire because it already has at the source site. Read about that in the streams documentation on page 4-25. To change the "fire once" property of the trigger, use the procedure SET_TRIGGER_FIRING_PROPERTY in the DBMS_DDL package.
    Hope this helps.
    Claudine

  • Confusion in Order of row and statement level trigger

    Hi can anyone tell me, if i create some trigger on table emp as in below order..
    BEFORE INSERT .. ROW LEVEL
    BEFORE INSERT .. STMNT LEVEL
    AFTER INSERT .. ROW LEVEL
    AFTER INSERT .. STMNT LEVEL
    than what will will be order of execution of trigers?
    How oracle will decide order?
    plz provide me some documents related to triggers execution order..thnx in advance..!

    PC wrote:
    Hi.. Got answer about order..but 1 strange point i m feeling that
    in case of, before insert.. stmnt level triger fire 1st then before insert.. row level.
    but in case of after insert.. row level trigger fireing 1st then after insert.. stmnt level ..
    can you explain this also..Why is it strange.
    You've got a statement you are executing.
    The first thing possible is that you are 'before' the statement.
    The next thing possible is that the statement executes for each row.
    Thus for each row, there is a point 'before' each row and a point 'after' each row.
    Once the statement has executed, you are 'after' the statement.
    So, it is only logical that the statement triggers surround the statement and the row triggers are within the statement, and of course 'before' comes before 'after'.

Maybe you are looking for

  • WSUS updates not applying to Office 2013 Home and Business OEM version

    Hi For some reason I cannot get WSUS updates to automatically install on clients running Office 2013 Home and Business OEM version. For example If user opens any of the office 2013 apps e.g. Outlook , word etc, it prompts a message at the top under t

  • Error While Entering the Data: Code and Name

    Hi Experts, I have defined the Two User Defined tables and SBO created Two User Defined Forms. i am able added the Data in One of the Form with the same value in Code columns for multiple rows and different value in Name columns for multiple rows. bu

  • MSE kernel upgrade after new installation

              upon bootup and stopping the mse server, I receive the following error messages: iptables v1.3.5: can't initialize iptables table `filter': iptables who? (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. iptable

  • OS authentication via Web interface (Intranet) possible?

    Hi, I have database users that have access to iFS too. The database users are OS authenticated. It anoyes them, that contrary to the standard explorer interface, the Web (IE) interface requires them to type in their OS password. I did not find any me

  • HT4623 how to upgrade personal hotspot for iphone 3G

    how to install personal hotspot for my old iphone 3G