After Update Trigger issue

Hello,
I am having a problem with after update trigger. I have created an after update trigger in Oracle that would call a procedure to run an Oracle report. The problem is that when the report is run, the table is not updated yet. So the table passes old values to the report. Is there any way I can take care of this issue? How do I make sure the table is updated before running the report? I tried delaying the report by using dbms_job package. I didn't have any success with that. Probably I am doing something wrong. This is the code I used
dbms_job.submit( job => l_job, what => 'SendPDFReport(:new.query_id,serviceid,:new.site_id);', next_date => sysdate+3/24*60 );
Thanks
Oracle database User

It is working. I used the same code,but I was using parameters inside the single quote, so it was taking the parameter value as :new.query_id instead of 12345.
I made changes
from
dbms_job.submit( job => l_job, what => 'SendPDF(:new.query_id,serviceid,:new.site_id);', next_date => sysdate);
to
dbms_job.submit( job => l_job, what => 'SendPDF('||:new.query_id||','||serviceid||','||:new.site_id||');', next_date => sysdate);
Thanks for all your help.

Similar Messages

  • 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.

  • Before update and after Update trigger

    Hi,
    I am following the below approach to overcome ORA-04091: table XXXX is mutating error.
    1. In the after update row level trigger i am capturing rowids of changed rows into a table type (of type rowid) defined in a package.
    2. In the after update statement level trigger i am using the data from the table type ( that got populated in the first step) to do my work.
    3. In the before update statement level trigger i am resetting the table type defined in the package.
    Now, can the below situation occur causing the system to fail
    1. A Update to the table occurred causing the before update statement level trigger to fire and reset the table type.
    2. After that row level after update trigger gets executed and captures the required data.
    3. Now before the after update statement level trigger gets executed a new update to the table happened ( to some other row as multiple users are using the application) causing the
    before update statement level to fire and erase the data from the table type?
    I want to know if above situation can occur or is the execution or before and after update triggers atomic?
    Thanks for helping.
    TIA
    Harsha

    A collection in a package is local to the session. And a given session can be processing one SQL statement at a time. So any concurrent updates would be happening in a different session with a different logical collection.
    You may encounter problems if your session is trying to update the same rows that other sessions are trying to update (whether via the original update statement or via the updates issued by the trigger). You could encounter performance problems because of row level locks or you could encounter deadlocks. But your session's collection won't be initialized by some other session's actions (other than DDL that replaced the package itself).
    Justin

  • After update trigger with condition

    Dear members,
    I have a table with multiple columns on each update on these columns I have to update another table columns.
    for one column the following trigger is working fine, but there are about more than 10 columns which I have to check for.
    I want to create only one after update trigger on this table and check which column is updated and update the same column in 2nd table.
    here is the trigger:
    CREATE OR REPLACE TRIGGER ABC_RATE_UPD
    AFTER UPDATE
       OF RATE
       ON ABC_PCD 
       REFERENCING NEW AS New OLD AS Old
       FOR EACH ROW
    DECLARE
      BEGIN
        UPDATE RM_TRAN_IN
        SET RATE = :NEW.RATE
        WHERE RM_PCD_ID = :NEW.RM_PCD_ID;
       EXCEPTION
         WHEN OTHERS THEN
           -- Consider logging the error and then re-raise
           RAISE;
    END ABC_RATE_UPD; here is my if condition, (edited)
    if :NEW.RATE != :OLD.RATE then
            UPDATE ABC_TRAN_IN
            SET RATE = :NEW.RATE
            WHERE ABC_PCD_ID = :NEW.ABC_PCD_ID;
        ELSIF :NEW.PACK_UNIT_ID != :OLD.PACK_UNIT_ID then
            UPDATE ABC_TRAN_IN
            SET PACK_UNIT_ID = :NEW.PACK_UNIT_ID
            WHERE ABC_PCD_ID = :NEW.ABC_PCD_ID;
    END IF;
        Its working good, is this a good approach, to the solution?
    regards:
    Edited by: user2040934 on Dec 29, 2012 3:22 PM

    In your trigger if you update more than one column at a time will it update all the updated columns in the other table properly?
    Can't you code something like this
    CREATE OR REPLACE TRIGGER ABC_RATE_UPD
    AFTER UPDATE
       OF col1,col2 , col3
       ON ABC_PCD 
       REFERENCING NEW AS New OLD AS Old
       FOR EACH ROW
    DECLARE
      BEGIN
    if updating ('col1') then
        UPDATE RM_TRAN_IN
        SET col1 = :NEW.col1
        WHERE :old.id = :NEW.id;
      end if;
      if updating ('col2') then
        UPDATE RM_TRAN_IN
        SET col2 = :NEW.col2
        WHERE :old.id = :NEW.id;
      end if;
       if updating ('col3') then
        UPDATE RM_TRAN_IN
        SET col3 = :NEW.col3
        WHERE :old.id = :NEW.id;
      end if;
       EXCEPTION
         WHEN OTHERS THEN
           -- Consider logging the error and then re-raise
           RAISE;
    END ABC_RATE_UPD;

  • How can I access the same table within AFTER UPDATE trigger?  mutating

    I'm trying to have processing done within a before or after update trigger.
    reduced what I want to do down to a select within the trigger.
    create or replace TRIGGER "AU_TABLE_A"
    after update on "TABLE_A"
    for each row
    declare
    l_res_status NUMBER:=0;
    l_count NUMBER:=0;
    begin
    SELECT COUNT(*) INTO l_count
    FROM TABLE_A
    WHERE ID = :NEW.ID AND STATUS_ID = 9;
    end;
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1,
         ORA-04091: table TABLE_A is mutating, trigger/function may not see it
         ORA-06512: at "BHRS.BU_MR_RES_APPR", line 13
         ORA-04088: error during execution of trigger 'BHRS.BU_MR_RES_APPR',
         update TABLE_A set "ID" = :b1, "STATUS_ID" = :b2, "COMMENTS" = :b3
         where "ID" = :p_pk_col
    IS THERE A WAY AROUND IT?
    Thank you, Bill

    The very common approach to workaround mutating table problem is passing the table state through the package variables. I.e. - you create a package with one global variable ( say l_count). Then you need
    1) a trigger before update for statement - here you counts your rows and set the package variable accordingly.
    2) a trigger after update for each row - here you read the rowcount from a package variable and do your actual work
    3) a trigger after update for statement - here you reset your package variable.
    This approach uses the fact, that mutating table problem occurs only with triggers for each row and the order of execution of different trigger types.
    However, counting records in every update statement (whereas not so worse although as doing this for each row within an update) may consume a lot of resources, so, possibly , you can rethink your business needs/approach.
    Best regards
    Maxim

  • After Update Trigger not triggering for first update

    Hi All,
    I have written a Trigger on AP_SUPPLIERS table to update AP_SUPPLIER_SITES_ALL when payment priority gets updated on AP_SUPPLIERS table. Trigger calls a pragma autonomous procedure after update happens, and updates sites table. We are on R12 (12.1.3) with  DB 11.2.0.3.0
    Somehow this is not working for the first update, after that for every update it is working. Any idea why this might be happening?
    Trigger Code: 
    CREATE OR REPLACE TRIGGER XX_AP_SUPPLIER_SIT_UPD_SYNC
    AFTER UPDATE
    ON AP.AP_SUPPLIERS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    l_vendor_id     NUMBER;
    l_paym_priority NUMBER;
    BEGIN
       XX_AP_SUPSITE_UPDATE(:NEW.PAYMENT_PRIORITY, :NEW.VENDOR_ID);
       EXCEPTION
         WHEN OTHERS THEN
           RAISE;
    END XX_AP_SUPPLIER_SIT_UPD_SYNC;
    Procedure Code:
    CREATE OR REPLACE PROCEDURE APPS.XX_AP_SUPSITE_UPDATE (p_payment_priority  IN  NUMBER,p_vendor_id IN NUMBER) AS
      PRAGMA AUTONOMOUS_TRANSACTION;
      ex_custom EXCEPTION;
      PRAGMA EXCEPTION_INIT( ex_custom, -20001 ); 
    BEGIN
      UPDATE AP_SUPPLIER_SITES_ALL
      SET PAYMENT_PRIORITY =p_payment_priority
      WHERE VENDOR_ID = p_vendor_id;
      COMMIT;
    EXCEPTION 
    WHEN OTHERS THEN
        raise_application_error( -20001, 'Error while updating payment priority on Site '||SQLERRM );
    END XX_AP_SUPSITE_UPDATE;

    Thanks for your replies Saubhik/VT,
    now my trigger is compiled. but is not triggering. pl help me to resolve .....
    create or replace
    TRIGGER AUDIT_DEV.trg2
    AFTER DELETE OR UPDATE OF EMP_STATUS ON AUDIT_DEV.AUDIT_PERSONS
    FOR EACH ROW
    declare
    OSUSER varchar2(30);
         MACHINE varchar2(30);
         logon_time date;
    db_user varchar2(30);
    USERNAME VARCHAR2(30);
    EMP_USER_MODIFIED AUDIT_PERSONS.EMP_USER_MODIFIED%TYPE;
         EMP_DATE_MODIFIED AUDIT_PERSONS.EMP_DATE_MODIFIED%TYPE;
         EMP_SK AUDIT_PERSONS.EMP_SK%TYPE;
         EMP_ID AUDIT_PERSONS.EMP_ID%TYPE;
         EMP_NAME AUDIT_PERSONS.EMP_NAME%TYPE;
    EMP_RESIGNATION_DATE AUDIT_PERSONS.EMP_RESIGNATION_DATE%TYPE;
    BEGIN
    select     username,osuser,machine,logon_time into db_user,osuser,machine,logon_time from v$session where sid=(select sid from v$mystat where rownum=1);
    INSERT INTO AUDIT_DEV.AUDIT_PERSONS_LOG (EMP_USER_MODIFIED,EMP_DATE_MODIFIED,EMP_SK,EMP_ID,EMP_NAME,EMP_RESIGNATION_DATE,EMP_STATUS_OLD,EMP_STATUS_NEW,osuser,db_user,machine)
    VALUES(EMP_USER_MODIFIED,EMP_DATE_MODIFIED,EMP_SK,EMP_ID,EMP_NAME,EMP_RESIGNATION_DATE,:old.EMP_status,:new.EMP_status,osuser,db_user,machine );
    COMMIT;
    END;
    09:59:06 AUDIT_DEV@dev>UPDATE AUDIT_DEV.AUDIT_PERSONS SET EMP_STATUS='TEST' WHERE EMP_ID='4234';
    EMP_STATUS
    TEST
    1 row selected.
    Elapsed: 00:00:00.01
    10:00:03 AUDIT_DEV@dev>commit;
    Commit complete.
    Elapsed: 00:00:00.01
    10:00:17 AUDIT_DEV@dev>select * from AUDIT_persons_log;
    no rows selected
    Elapsed: 00:00:00.00
    10:00:17 AUDIT_DEV@dev>
    Edited by: Abk on Nov 4, 2010 10:42 AM

  • After update performance issue with certain PCs

    Over the past 2 months there was an update to the Forefront Client that caused a strange issue on some of our machines.  Basically when we update device drivers MsMpEng.exe goes nuts and uses at least 50% to 98% of the CPU for the entire duration of
    the driver install/update.  
    The immediate result is that some of the larger device driver installs (like video drivers) actually time out because of this.  Using procmon I traced the cause of the delay. It looks like MsMpEng is scanning the setupapi.dev.log file over and over
    and over..hundreds..maybe thousands of times.  We noticed that if we turned off logging for the device driver udpate/install and app install logging that this issue disappears.  We've had this level of logging for years and only in the past 2 months
    or so has this issue started to pop up.  The setupapi.dev.log file is rather large and so I can see why it's causing a delay if it has to scan the file over and over and over.
    We aren't sure what changed.  We used an older image that had an older version of the Forefront client installed and we made sure it didn't update to a newer client version.  That version of forefront had no issue with device drivers timing out. After
    updating the client we now have the issue. A change was made recently and we believe the forefront client is behaving differently.  
    Any ideas about what could cause this?
    Thanks.

    Hi,
    Thanks for your question.
    How did you perform the update of Forefront Client Security, from windows update or manually? In addition, what are the editions of the Forefront Client Security now and before
    you updated?
    Best regards,
    Susie

  • After update trigger

    Hi,
    We have one table which is copied to another schema and added some new columns to it,
    SQL>desc Source.content
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER(9)
    RESOURCEID                                NOT NULL NUMBER(9)
    APPOINTMENTDATE                           NOT NULL DATE
    STARTTIME                                          DATE
    ENDTIME                                            DATE
    STATUS                                             VARCHAR2(20)
    MASTERRESOURCEID                                   NUMBER(9)
    REFERENCEID                               NOT NULL NUMBER(9)
    PROPREF                                            NUMBER(9)
    SQL> desc target.content
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER(9)
    RESOURCEID                                NOT NULL NUMBER(9)
    APPOINTMENTDATE                           NOT NULL DATE
    STARTTIME                                          DATE
    ENDTIME                                            DATE
    STATUS                                             VARCHAR2(20)
    MASTERRESOURCEID                                   NUMBER(9)
    REFERENCEID                               NOT NULL NUMBER(9)
    PROPREF                                            NUMBER(9)
    OLD_STARTDATE                                      DATE 
    OLD_STARTTIME                                      DATE
    OLD_RESOURCEID                                     NUMBER(9)
    OLD_MASTERRESOURCEID                               NUMBER(9)
    LAST_UPDATE_DATE                                   DATE
    ACTION_FLAG                                        VARCHAR2(20)I have created one "After Insert" trigger on the source.content table, to insert the data to target.content table after each Insert transaction happened on Source.content, this trigger is working fine and the target.content table is getting all the new rows in it as well.
    Now I want to implement the same thing in Updates as well, after any update on source.content table, it should be reflected in target.content table along with the new set of columns should have the old values.
    •     OLD_STARTDATE: Old APPOINTMENTDATE of the record if updated.
    •     OLD_STARTTIME: Old STARTTIME of the record if updated.
    •     OLD_ RESOURCEID: Old RESOURCEID of the record if updated.
    •     OLD_MASTERRESOURCEID: Old MASTERRESOURCEID of the record if updated.
    •     LAST_UPDATE_DATE: This will be the timestamp of the insert/update transaction to this table
    •     ACTION_FLAG:
    NEW: If this is a new appointment in the system
    UPDATE: If an existing appointment is being updated in the system
    Kindly help me in writing this trigger,
    Thanks in advance.

    user-1221 wrote:
    Hi,
    We have one table which is copied to another schema and added some new columns to it,
    SQL>desc Source.content
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER(9)
    RESOURCEID                                NOT NULL NUMBER(9)
    APPOINTMENTDATE                           NOT NULL DATE
    STARTTIME                                          DATE
    ENDTIME                                            DATE
    STATUS                                             VARCHAR2(20)
    MASTERRESOURCEID                                   NUMBER(9)
    REFERENCEID                               NOT NULL NUMBER(9)
    PROPREF                                            NUMBER(9)
    SQL> desc target.content
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER(9)
    RESOURCEID                                NOT NULL NUMBER(9)
    APPOINTMENTDATE                           NOT NULL DATE
    STARTTIME                                          DATE
    ENDTIME                                            DATE
    STATUS                                             VARCHAR2(20)
    MASTERRESOURCEID                                   NUMBER(9)
    REFERENCEID                               NOT NULL NUMBER(9)
    PROPREF                                            NUMBER(9)
    OLD_STARTDATE                                      DATE 
    OLD_STARTTIME                                      DATE
    OLD_RESOURCEID                                     NUMBER(9)
    OLD_MASTERRESOURCEID                               NUMBER(9)
    LAST_UPDATE_DATE                                   DATE
    ACTION_FLAG                                        VARCHAR2(20)I have created one "After Insert" trigger on the source.content table, to insert the data to target.content table after each Insert transaction happened on Source.content, this trigger is working fine and the target.content table is getting all the new rows in it as well.
    so please post trigger source code

  • After update trigger firing on after insert

    Hi All,
    I am using oracle database version 8i.
    I have one database trigger
    create or replace trigger mna_post_update
    after update
    on mobile_number_actions
    for each row
    when (new.mna_status = 'P'
    and new.mna_type in ('I','C','R','D','M','T','A','N','O'))
    begin
    insert into test1234 values (:new.mna_mcp_serial_no,:old.mna_mcp_serial_no);
    end;
    The problem is that it is giving the same value for :new.mna_mcp_serial_no and :old.mna_mcp_serial_no. And also in my table insertion is taken place not updates I have no idea why this trigger is firing on insert?
    Could any one please tell me how is this possible?
    Please help !!

    Are you sure you don't have a similar trigger that is firing on inserts (perhaps you were debugging this code and inadvertently created one that fired on inserts or on inserts & updates)?
    Assuming you are updating MNS_MCP_SERIAL_NO, you should be getting different values in test1234. If you are not, can you post a brief test case (including DDL to create the objects) that shows the problem(s) you're seeing?
    Justin

  • After update trigger help

    I am getting a trigger error when updating a table. Here is the trigger :
    CREATE OR REPLACE TRIGGER "SCHEMA"."UPD_SOMETABLE" AFTER
    UPDATE ON "SCHEMA"."UPD_SOMETABLE" REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN
    UPDATE "SCHEMA"."UPD_SOMETABLE" SET "DATE_UPDATED" = SYSDATE
    END;
    ALTER TRIGGER "SCHEMA"."UPD_SOMETABLE" ENABLE;
    The error :
    SQL Error: ORA-04098: trigger 'SCHEMA.UPD_SOMETABLE' is invalid and failed re-validation
    04098. 00000 - "trigger '%s.%s' is invalid and failed re-validation"
    *Cause:    A trigger was attempted to be retrieved for execution and was
    found to be invalid. This also means that compilation/authorization
    failed for the trigger.
    *Action:   Options are to resolve the compilation/authorization errors,
    disable the trigger, or drop the trigger.

    The syntax error is the lack of a semicolon after SYSDATE. There is also an error that the table name and trigger name are the same but I'm guessing that's something you did in sanitizing the code before posting it
    Once you fix the syntax error, however, you're very likely to get a runtime mutating table error.
    If your intention is to set the DATE_UPDATED column to SYSDATE for each row that is updated, you'd need to use a before update trigger, you'd adjust the :new.date_updated, and you'd fix the syntax error. Something like
    CREATE OR REPLACE TRIGGER trigger_name
      BEFORE UPDATE ON table_name
      FOR EACH ROW
    BEGIN
      :new.date_updated := sysdate;
    END;If you are trying to do something other than what I guessed above, please let us know what you are trying to get the trigger to do.
    Justin

  • After insert trigger issue

    Hi All,
    Can I have an after insert trigger on a table wherein the execution is also on the same table?
    It's like 10 columns in the table A.
    During a new row insertion, except one specific column(say 'J'), remaining all getting data.
    Now 'after insert', need to update the data of the column J based on one inserted value for column say ID.
    Code goes like below:
    CREATE OR REPLACE TRIGGER UPDATE_J
    AFTER INSERT ON A REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    begin
    if :new.ID = 'N%' then
         :new.J:= 'N';
    else
         :new.J:= 'M';
    end if;
    end;
    Below is the error when I tried to execute that.
    ORA-04091: table string.string is mutating, trigger/function may not see it
    Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.
    Action: Rewrite the trigger (or function) so it does not read that table.
    Any idea to resolve?
    Regards,
    Seetharaman.

    Hi,
    The docs say
    Restrictions on AFTER
          An AFTER row trigger or AFTER row section of a compound trigger can only read but not write into the :OLD or :NEW fields. When faced with problems like this, it is always a good thing to consult the documentation.
    Regards
    Peter

  • After Insert Trigger with DML on the subject table?

    I am trying to set up e-mail notifications, so I created a procedure, which accepts the argument of an id. In the procedure, it queries the table and sends out mail based on the result set. (in the trigger, I pass in the value of :NEW.id). The procedure then queries the table for that row id.
    First, for the after update I was getting the error:
    ORA-04091: table is mutating, trigger/function may not see it ORA-06512
    So, I was advised to do in the declare block: pragma autonomous_transaction; I did that, and that solved the problem there. SO I did the same in the after insert trigger, but then I get the error:
    ORA-00060: deadlock detected while waiting for resource ORA-06512
    I asked our DBA and he said you are not able to query the table of which the trigger is a subject of. I thought it would be possible since its After insert or update?
    Can anyone offer any suggestions ? :)
    Thanks,
    Trent

    Any reason why it would work in an after update trigger then?
    So, I was advised to do in the declare block: pragma autonomous_transaction; I did that, and that solved the problem therePRAGMA AUTONOMOUS_TRANSACTION "bends" the restriction against SQL against base table.
    It is the equivalent to tap dancing across a mine field.
    You might get the desired results most of the time or you might get a tasty surprise when you least expect it.
    What happens to your application in the future, if/when the UPDATE has a ROLLBACK issued & PRAGMA AUTONOMOUS_TRANSACTION has successfully completed?
    Inquiring minds would like to know the answer.

  • Chaging the table value after update

    Hi All,
    I want to update a certain column ( date column ) after update is done. I can do this using "before update" trigger. But I'm getting some transaction issues when the trigger is written as before update ( Error from java side saying data is modified outside the transaction ) . So i was wondering whether there's another way to achieve the same, whether I can change data after update is done. I searched the net and found "cannot change NEW values for this after update trigger type". Anyone knows how to do this ?
    Thanks in Advance !

    Hi all,
    I found the real reason for this problem. Entity bean for table which I'm trying to write trigger, has concurrency-strategy="Optimistic" and optimistic-column="db_mod_date". This db_mod_date is the column which I was trying to update using a trigger.
    i.e Following configuration set to entity bean. Therefore weblogic updating "db_mod_date", hence no need of trigger.
    @weblogic.cache concurrency-strategy="Optimistic" max-beans-in-cache="200" idle-timeout-seconds="60" cache-between-transactions="true"
    @weblogic.persistence delay-updates-until-end-of-tx="True" verify-columns="Timestamp" optimistic-column="db_mod_date"
    More Details
    [http://docs.oracle.com/cd/E11035_01/wls100/perform/EJBTuning.html|http://docs.oracle.com/cd/E11035_01/wls100/perform/EJBTuning.html]
    Thanks !

  • BEFORE UPDATE Trigger

    Hi,
    I'm looking for a solution to find out which columns are set in the update-statement inside a before update trigger. Can someone give me a hint?!
    What I want to do:
    I want to ensure that an update-statement for a special table always include attribute "XXX". To declare this attribute as "not null" is useless, because it is set correctly at insert. To compare the new value against the old value in a before update trigger isn't possible because the new value can be the same as the old value.
    I'm using Oracle 8i.

    There is no need to use two triggers and a temporary table where a simple insert from the before trigger will do the job.
    You can just insert the :old.column values straigth into a history table within the before update trigger though I would prefer to use an after update trigger. Nevertheless, both the insert into history and the update will be part of one transaction so the two action will commit or rollback together:
    UT1 > create or replace trigger marktest_bu
    2 before update on marktest
    3 for each row
    4 begin
    5 insert into marktest_hist
    6 values (:old.fld1, :old.fld2, :old.fld3, :old.fld4);
    7 end;
    8 /
    Trigger created.
    UT1 > select * from marktest_hist;
    no rows selected
    UT1 > update marktest set fld1 = 'trigtest2'
    2 where fld1 = 'trigtest';
    1 row updated.
    UT1 > select * from marktest_hist;
    FLD1 FLD2 FLD3 FLD4
    trigtest 9 28-MAY-04 trigtest
    IMHO -- Mark D Powell --

  • Problems with After Report trigger Updating using User-defined functions

    Hi,
    I have a report which uses SQL to select data that uses a user-defined stored function in the WHERE clause.
    I use the same SQL in the After Report trigger with and UPDATE statement to flag all records selected as being run.
    Data is being selected by the report no problem, but the records are not being updated. In a test, If I remove the conditions using the user functions, the records update as expected. In Live conditions I must have these conditions in the script.
    I originally tried putting the UPDATE in a formual column, but that would not fire on records where that page was not paged through (or paged to end) in the Runtime Previewer.
    Can anyone advise?

    In case anyone is interested.
    The issue was that the stored functions have roles assigned for security.
    PL/SQL for After Report doesn't seem to recognise the roles having been assigned for the report, so the implicit cursor update/select I had wouldn't work.
    I changed the SELECT into an explicit CURSOR and introduced a FOR LOOP, keeping the UPDATE as an implicit statement.
    I know see this was more of a PL/SQL issues than a report one, but such is life. So if anyone feels the urge to move it to the PL/SQL forum, then feel free!!
    Have a problem free afternoon. :-)

Maybe you are looking for