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

Similar Messages

  • Difference between Before INSERT and After INSERT trigger?

    What is difference between Before INSERT and After INSERT triggers? Can anyone give me a simple example from SCOTT schema for both of these triggers.

    The documentation gives a good explanation have you looked at....
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm#sthref1175

  • Before image and after image is not updating correctly with 2LIS_04_P_ARBPL

    Hello BW gurus
    I am facing problem with the posting date extraction from the extractor 2lis_04_p_arbpl. I am getting incorrect before image and after image. Please let me know how to solve this problem.
    Thanks and regards
    kiran.

    Hi,
    It is difficult to check this in the Source System and there is no direct method. I can give you a workaround which we did analysed for some of delta datasources.
    Steps to be followed sequentiall once the step is successful:
    1. Create a Production order or something.. Note down the number.
    2. Check the datasource whether you get the same Production Order as delta
    3. Now do whatever confirmation etc . for the same Production Order
    4. Check the datasource (RSA3) and see wat it extracts.. might be multiple records..
          In that case just see the sequence of records.. and the changes each record has brought in.. hope this way we can simulate the delta datasource realtime..
    And if you find the sequence or somthin is correct and in BW is not updating properly then it is our fault to dig and find out further.. If the issues is at the RSA3 itself, then u can raise an OSS Message as a Bug.
    Hope it helps.
    Regards,
    Chathia.

  • Mutating error : row level BEFORE UPDATE trigger

    Hi,
    I had an issue on mutating terror(was trying to write a row level BEFORE update trigger), however i got it resolved after refering tom kytes web site. I thought i would share it with everyone, might be helpful for a few... Thanks!
    I will be more than happy to learn on further better ways of resolving this issue.
    Below I have posted the trigger that was causing this error and the work around for that issue, I created a package and three other triggers to replace row level BEFORE update trigger:
    ++trigger that was causing this issue:++
    CREATE OR REPLACE TRIGGER C_F_BI
    BEFORE INSERT ON CONTACT_FUNCTION FOR EACH ROW
    declare
    cursor function_code_cur ( cur_contact_id CONTACT.Contact_Id%type,
    cur_function_type_code CONTACT_FUNCTION.Function_Type_Code%type)
    is
    select
    cft.function_type_code,
    cft.multiples_permitted
    from
    CONTACT_FUNCTION cf,
    CONTACT c,
    CONTACT_FUNCTION_TYPE cft
    where
    c.acct_id = (select acct_id from contact where contact_id = cur_contact_id)
    and c.contact_id = cf.contact_id
    and cf.function_type_code = cft.function_type_code
    and cft.function_type_code = cur_function_type_code;
    v_function_type_code contact_function_type.function_type_code%type;
    v_multiples_permitted contact_function_type.multiples_permitted%type;
    E_Multiples_Not_Permitted Exception;
    begin
    if not function_code_cur%isopen then
    open function_code_cur(:new.contact_Id,:new.function_type_code);
    end if;
    loop
    fetch function_code_cur into v_function_type_code, v_multiples_permitted;
    exit when not function_code_cur%found;
    end loop;
    ** if the fetch returns a v_multiples_permitted of 'Y' or no record is found, then it is
    ** ok to add the record. Otherwise raise an error because that function_type is already
    ** being used at the current acct.
    if v_multiples_permitted = 'N' then
    raise E_Multiples_Not_Permitted;
    end if;
    close function_code_cur;
    EXCEPTION
    when E_Multiples_Not_Permitted then
    raise_application_error( -20001,'Multiples not allowed for function type ' ||
    v_function_type_code || '. sqlerrm - ' || sqlerrm );
    when others then
    raise;
    end;
    ++solution for above issue :++
    create or replace package state_pkg
    is
    type ridArray_rec is record(rid rowid, cont_id number, cont_fn_type varchar2(20));
    type ridArray is table of ridArray_rec index by binary_integer;
    newRows ridArray;
    empty ridArray;
    end state_pkg;
    create or replace trigger contact_function_bu1
    before update on contact_function
    begin
    state_pkg.newRows := state_pkg.empty;
    end;
    create or replace trigger contact_function_bu2
    before update ON CONTACT_FUNCTION FOR EACH ROW
    DECLARE
    I NUMBER:=0;
    begin
    I := state_pkg.newRows.count+1;
    state_pkg.newRows( I ).rid := :new.rowid;
    state_pkg.newRows( I ).cont_id := :new.contact_id;
    state_pkg.newRows( I ).cont_fn_type := :new.function_type_code;
    end;
    create or replace trigger contact_function_bu
    after update ON CONTACT_FUNCTION
    declare
    cursor function_code_cur ( cur_contact_id CONTACT.Contact_Id%type,
    cur_function_type_code CONTACT_FUNCTION.Function_Type_Code%type,
    rid2 rowid)
    is
    select
    cft.function_type_code,
    cft.multiples_permitted
    from
    CONTACT_FUNCTION cf,
    CONTACT c,
    CONTACT_FUNCTION_TYPE cft
    where
    c.acct_id = (select acct_id from contact where contact_id = cur_contact_id)
    and c.contact_id = cf.contact_id
    and cf.function_type_code = cft.function_type_code
    and cft.function_type_code = cur_function_type_code
    and cf.rowid = rid2;
    v_function_type_code contact_function_type.function_type_code%type;
    v_multiples_permitted contact_function_type.multiples_permitted%type;
    E_Multiples_Not_Permitted Exception;
    begin
    for i in 1 .. state_pkg.newRows.count loop
    if not function_code_cur%isopen then
    open function_code_cur(state_pkg.newRows(i).cont_id, state_pkg.newRows(i).cont_fn_type, state_pkg.newRows(i).rid);
    end if;
    loop
    fetch function_code_cur into v_function_type_code, v_multiples_permitted;
    exit when not function_code_cur%found;
    end loop;
    ** if the fetch returns a v_multiples_permitted of 'Y' or no record is found, then it is
    ** ok to add the record. Otherwise raise an error because that function_type is already
    ** being used at the current acct.
    if v_multiples_permitted = 'N' then
    raise E_Multiples_Not_Permitted;
    end if;
    close function_code_cur;
    end loop;
    EXCEPTION
    when E_Multiples_Not_Permitted then
    raise_application_error( -20001,'Multiples not allowed for function type ' ||
    v_function_type_code || '. sqlerrm - ' || sqlerrm );
    when others then
    raise;
    end;
    /

    It seems you could have solved the issue otherwise:
    CREATE OR REPLACE TRIGGER c_f_bi
       BEFORE INSERT
       ON contact_function
       FOR EACH ROW
    DECLARE
       v_function_type_code        contact_function_type.function_type_code%TYPE;
       v_multiples_permitted       contact_function_type.multiples_permitted%TYPE;
       e_multiples_not_permitted   EXCEPTION;
    BEGIN
       BEGIN
          SELECT cft.function_type_code, cft.multiples_permitted
            INTO v_function_type_code, v_multiples_permitted
            FROM contact c, contact_function_type cft
           WHERE c.acct_id = (SELECT acct_id
                                FROM contact
                               WHERE contact_id = :NEW.contact_id)
             AND c.contact_id = :NEW.contact_id
             AND cft.function_type_code = :NEW.function_type_code;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             v_function_type_code := :NEW.function_type_code;
             v_multiples_permitted := '?';
       END;
    ** if the query returns a v_multiples_permitted of 'Y' or no record is found, then it is
    ** ok to add the record. Otherwise raise an error because that function_type is already
    ** being used at the current acct.
       IF v_multiples_permitted = 'N'
       THEN
          RAISE e_multiples_not_permitted;
       END IF;
    EXCEPTION
       WHEN e_multiples_not_permitted
       THEN
          raise_application_error (-20001,
                                      'Multiples not allowed for function type '
                                   || v_function_type_code
                                   || '. sqlerrm - '
                                   || SQLERRM
       WHEN OTHERS
       THEN
          RAISE;
    END;
    /:p

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

  • Slow update on 11g in conjuction with before update trigger

    Hello,
    I have strange problem - when on table exists before update trigger(in its body is nothing important, maybe problem is on other triggers aswell), then repeating update on this table is slower and slower on 11g, on 10g it is ok. Problem is on windows and linux platform aswell.
    I created some scripts to simulate this behavior, in table is 60 000 row. In one loop I update all 60 000 rows from table and measure time.
    Can someone tell me where problem is and if it is possible to manage it with some settings or anyway ? In our application it is big problem, similar operation takes days ......
    thanks tomas
    times for 10g:
    Trigger disabled
    Loop 1 - 6,13 secs
    Loop 2 - 2,92 secs
    Loop 3 - 3,19 secs
    Loop 4 - 2,95 secs
    Loop 5 - 3,39 secs
    Trigger enabled
    Loop 1 - 4,83 secs
    Loop 2 - 3,78 secs
    Loop 3 - 4,75 secs
    Loop 4 - 3,91 secs
    Loop 5 - 3,81 secs
    times for 11g:
    Trigger disabled
    Loop 1 - 2,27 secs
    Loop 2 - 2,4 secs
    Loop 3 - 2,3 secs
    Loop 4 - 2,42 secs
    Loop 5 - 2,36 secs
    Trigger enabled
    Loop 1 - 8,01 secs
    Loop 2 - 17,22 secs
    Loop 3 - 29,21 secs
    Loop 4 - 58,43 secs
    Loop 5 - 115,59 secs
    script for create test table
    CREATE TABLE SD3Test
       (MPID INTEGER NOT NULL ENABLE,
    ROWCOUNT NUMBER(10,0),
    CLOSEDROWCOUNT NUMBER(10,0),
    AMOUNT NUMBER(18,2) DEFAULT 0 NOT NULL ENABLE,
    LOCALAMOUNT NUMBER(18,2) DEFAULT 0 NOT NULL ENABLE,
    CLOSED CHAR(1 BYTE) DEFAULT 'N' NOT NULL ENABLE);
    ALTER TABLE SD3Test ADD CONSTRAINT SD3TestPK PRIMARY KEY (MPID);
    --fill test data
    DECLARE mCnt INTEGER;
    BEGIN
    mCnt := 0;
    FOR mCnt IN 1..60000 loop
      INSERT INTO SD3Test (MPID, Amount, LocalAmount, RowCount, ClosedRowCount)
      VALUES(mCnt, 0, 0, 0, 0);
    END loop;
    END;
    --create trigger
    CREATE OR REPLACE TRIGGER SD3TestAU
      BEFORE UPDATE ON SD3Test FOR EACH ROW
    DECLARE
    mInt INTEGER;
    BEGIN
      /*original code of our trigger, but performance problem is
    not depend on it, just depend on existence of this trigger
    IF ((:new.RowCount=:new.ClosedRowCount) and (:new.RowCount>0)) THEN
      :new.Closed:='A';
    ELSE
      :new.Closed:='N';
    end if;
    mInt := 1;
    END;
    / script for run test
    --test for updates with trigger disabled and enabled
    set serveroutput on;
    DECLARE
      mCnt INTEGER;
      mLoop INTEGER;
      mDisEna INTEGER;
      mStart NUMBER;
      mStop NUMBER;
    BEGIN
    --2 loops - first with disabled trigger, second with enabled trigger
    FOR mDisEna IN 1..2 loop
      IF mDisEna = 1 THEN
       execute immediate 'ALTER TRIGGER SD3TestAU disable';
       dbms_output.put_line('Trigger disabled');
      ELSE
       execute immediate 'ALTER TRIGGER SD3TestAU enable';
       dbms_output.put_line('Trigger enabled');
      END IF;
      -- 3 inner loops for measure time
      FOR mLoop IN 1..3 loop
        --update on all records in table
       mStart := dbms_utility.get_time;
       FOR mCnt IN 1..60000 loop
        UPDATE SD3Test
         SET
        ROWCOUNT = ROWCOUNT+1,
        CLOSEDROWCOUNT = CLOSEDROWCOUNT+1,
        AMOUNT = AMOUNT + mCnt,
        LOCALAMOUNT = LOCALAMOUNT + mCnt
        WHERE
         MPID = mCnt;
       END loop;
       mStop := dbms_utility.get_time;
       dbms_output.put_line('Loop ' || mLoop || ' - ' || round((mStop - mStart)/100,2) || ' secs');
      END loop;
    END loop;
    END;
    /

    Hello,
    Your case has been reported as a bug #7173924 (TRIGGER IS MUCH SLOWER IN 11G) few days ago.
    Still on analyze.
    Nicolas.

  • Before image and after image concept of ODS

    Hi Gurus,
    Could anybody help me in understanding the concept of " Before image and after image in ODS"
    Kindly forward me if any good docs are available on my email ID: [email protected]
    With regards,
    wrushali

    check this link for after image.
    Re: regarding ODS
    and before image is snapshot of the data before a change took place
    after image is snapshot of the data after change.
    these are used for delta update.
    Hope it helps.
    Regards

  • Size of SQL query before execution and after execution

    hi all
    I need help on how can i find out the size of SQL query before execution and after execution in java
    The query can be any query select / insert / update
    Can anyone help me if any system tables help to find out the required size i mentioned
    Urgent help is required
    Thanking in advance

    I need the size in terms of bytes
    like the rquirement is stated as below
    select ................: 10 B , return 250 B
    so i need size before and after execution in terms of bytes

  • Order printout before realse and after relase

    hi
    all
    order printout before realse and after relase
    is this possibile
    it gives message teco not done
    my client wants in preparation and after relerase
    though iknow no logic is there but they stick to this
    thanks
    manoj

    hi
    i think you can print the order after the releasing of order or at the time of put in process.
    kindly refer the following [link|http://help.sap.com/saphelp_erp60_sp/helpdata/en/5b/ae36044b8611d182ba0000e829fbfe/content.htm]
    regards
    thyagarajan

  • LO Cookpit: what is "Before Image" and "After Image" related to Delta ?

    Someone mentions "Before Image" and "After Image" which is related to Delta method in source systems.  Someone know what they mean?
    Thanks

    Before Image and After Image are different Record modes present.
    Before Image :
    Lets assume the data present in the Cube and ODS is
    Doc No --Mat Type --- QTY
    120 -
    M01----
    10
    Now let assume that the data has changes and the quatity has to be changed from 10 to 8.This can be done in different way depending on if we are using a Cube or ODS.
    If its a Infocube . i.e it is additive so we can send the before image and the after image together
    Eg:
    Doc No -
    MAT type -
    QTY
    120--M01--
    -10
    120--M01--
    8
    If the Data Source sends both the before image and the after image, this combination can be loaded in any cube or ODS target. For ODS targets, if Overwrite setting is made, then only the after image(the last one) will make it to the Activation queue table of the ODS. If the ODS is set to Addition then both before and after image are needed to make a correct load to the target.

  • Difference between Before aggregation and After aggregation

    Hello ,
       Can any one tell me what is d difference between Before and after aggregation of calculated key figure?
          Thanks,
    Aparna

    Before aggregation calculates the data before summarizing the final results while after aggregation, it will summarize the result first before it calculates.
    Assume:
    Customer#----
    Orders
    10000----
    10
    10001----
    20
    10000----
    30
    if you want to count the number of customers before aggregates and after aggregates gives you different result.
    Before aggregates will give you
    Customer#----
    Count
    10000----
    2
    10001----
    1
    After Aggregates will give you
    Customer#----
    Count
    100000----
    1
    100001----
    1
    Customer might not be a good example but the concept remains the same for others.
    thanks.
    Wond

  • After/before update trigger

    Hi All
    Does any onoe know
    what 's the difference between after update/insert trigger and before update/insert trigger
    on database tables.

    Hi
    The basic diffrence is
    Before Update triggers before the table is updated and
    After update triggers after the table is updated but
    before the implicit commit fires.
    therefore when you raise the application error a
    implicit Rollback happens and the record is not commited.
    Regards
    Shajesh Nair
    Deloitte.
    [email protected]

  • Help discovering what's wrong w/ my before update trigger

    Let me prefix this w/ the fact that I'm an idiot, so be kind.
    I have one trigger that is not working (seemingly), and I am about googled out so I thought I'd ask and see if anyone couldn't provide thoughts, insults, suggestions or what have you.
    Database being used is 10g XE and updates are being done transactionally.
    I have a table that stores (among other things) the status of a particular type of (app specific) transaction. When that status changes to a particular value, I have a trigger that updates another table with the date that this status change took place.
    <pre>Table: XTransaction
    id (pk)
    statusid (int)
    ...</pre>
    and here is what my trigger looks like:
    <pre>create or replace trigger x_transaction_update before update on xtransaction
    for each row
    declare
    begin
    if( :old.statusid = 1) then -- this is here because I got an error when I tried to use a when clause above
    begin
    -- I log before the update w/ some other info to tell whether I've been to this spot or not
    update sometable set when_it_happened = sysdate where xtransid = :old.id;
    -- I log after the update too
    exception
    when others then
    -- I log sqlerrm
    end;
    end;
    end if;
    end;</pre>
    here's what I've been able to gather through testing & viewing logs from the trigger:
    1. there's no exception being logged,
    2. the pre/post update logs with all the correct data (proving that the trigger is fired),
    3. when I update xtransaction from visual studio (through the oracle addin which lets you run queries against the database), the status is changed, the trigger is fired, and the other table is updated.
    4. when the application that normally updates the xtransaction table runs, xtransaction is updated, the trigger is fired, and sometable is not updated.
    so I have absolutely no clue where to go with this one. Usually I could fire up sql server's query analyser and watch what's coming through, and I've tried to use toad's commercial tool to do this, but to no avail. I've tried changing it to an after update, but had the same results. I wrote this some months ago, and it was working then, but not now.

    MadHatter wrote:
    @Centinul
    the only difference between what I posted and the actual trigger are table / column names, and a sproc I wrote for the logging in place of the comments I have:
    log_msg('update sometable set arrival = sysdate where transid = ' || :old.id);I know this doesn't answer the question you have now, you should seriously consider removing the WHEN OTHERS clause altogether OR ensure that there is a RAISE or RAISE_APPLICATION_ERROR there.
    This trigger isn't syntactically correct either:
    create or replace trigger x_transaction_update before update on xtransaction
    for each row
    declare
    begin
        if( :old.statusid = 1) then -- this is here because I got an error when I tried to use a when clause above
            begin
                -- I log before the update w/ some other info to tell whether I've been to this spot or not
                update sometable set when_it_happened = sysdate where xtransid = :old.id;
                -- I log after the update too
            exception
                when others then
                    -- I log sqlerrm
                end;
            end; /* Extra END here.... */
        end if;
    end;Edited by: Centinul on Oct 30, 2009 1:23 PM

  • Before Update Trigger has mutating problem

    I'm getting a mutating problem with this updating trigger. I'm not sure how to deal with it. Here is my code:
    CREATE OR REPLACE TRIGGER WTL_SMP_TRG2
    BEFORE UPDATE ON WTL_SAMPLES
    FOR EACH ROW
    DECLARE
         sampleCount NUMBER(1) := 0;
         dupLabSampleID NUMBER(8) := 0;
    BEGIN
         SELECT COUNT(sample_ID)
         INTO sampleCount
         FROM wtl_samples
    WHERE jb_job_id = :new.jb_job_id
    AND lab_no = :new.lab_no
         AND sample_ID != :old.sample_ID;
         IF sampleCount > 0 THEN
         SELECT sample_ID
         INTO dupLabSampleID
         FROM wtl_samples
         WHERE jb_job_id = :new.jb_job_id
         AND lab_no = :new.lab_no
              AND sample_ID != :old.sample_ID;
    RAISE_APPLICATION_ERROR(-20501, 'Update failed, Lab Number ' || :new.lab_no || ' is used by SampleID: ' || dupLabSampleID);
    END IF;
    --EXCEPTION
    --     WHEN OTHERS THEN
    -- RAISE_APPLICATION_ERROR(-20901, 'Error in WTL_SMP_TRG2.');
    END WTL_SMP_TRG2;
    any help appreciated
    adam

    I guess I couldve done that, but was using design editor and didn't know how to put a unique constraint in. Is the problem only because I'm referencing the :old.sample_ID, or the :new values as well? If it's just the :old value I could write a before update statement trigger to place the sample_id into a package varaible and then call that variable up in the row level trigger.... i've tried this, but don't know how to pull the sample_id value i need in the before statement trigger... i'll supply the code i've done so far...
    CREATE OR REPLACE TRIGGER WTL_SMP_TRG2_INIT
    BEFORE UPDATE ON WTL_SAMPLES
    DECLARE
    BEGIN
         wtl_trg_custom_pkg.oldSampleID := sample_id; /* Doesn't know sample_id...? */
    END WTL_SMP_TRG2_INIT;

  • Before Update Trigger compilation problem

    Hello experts! I have a compilation problem for a trigger I am trying to create.
    As a matter of fact it should update INT_INITIAL with the old value of INT_LOCK.
    The compilation fails and the debugger raises an ORA 01747 error (invalid declaration for user table, user column etc.)
    Do you have an idea what is wrong with my code?
    create or replace
    TRIGGER TRIGGER_INT_INITIAL
    BEFORE UPDATE ON  TBL_MATRIX_INTERMEDIATE_RESULT
    FOR EACH ROW
    Begin
      IF NVL(:new.INT_INITIAL, 0) != :old.INT_LOCK THEN
           UPDATE TBL_MATRIX_INTERMEDIATE_RESULT set
          :NEW.INT_INITIAL = :old.INT_LOCK;
      END IF;
    END;Regards,
    Seb

    Hi Seb,
    You don't need to use UPDATE stmt here as you are updating the same table on which your trigger is fired. So it may cause mutating table error too.
    when you use :new.colname it will immediately take care of the new value to be inserted in the respective column.
    So no need to write Update stmt.
    Hence remove,
    UPDATE TBL_MATRIX_INTERMEDIATE_RESULT set And use := is an assignment operator whereas = is to equate..
    :=Twinkle

  • Halting the update from a BEFORE UPDATE trigger

    Hello,
    I'm writing a trigger which is set to fire before update. One of the possible scenarios requires that the row being updated is not updated but instead deleted. Is it possible to send a DELETE query and then stop the update process so it doesn't spit out an error? I haven't tested this yet, but I'm quite sure it will give an error if it's trying to update a row which has just been deleted.
    Thanks,
    Pavel

    Hi,
    Personally, I don't like implement some business logic into trigger... so, why run an update whenever you need a delete ?
    I would modify the original code to delete in this case instead of update.
    My 2 cents,
    Nicolas.
    SQL> create table pavel (id number, txt varchar2(10));
    Table created.
    SQL> insert into pavel values (1, 'This one');
    1 row created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace trigger pavel_trg
      2  before update on pavel
      3  for each row
      4  begin
      5  delete from pavel where id = :old.id;
      6* end;
    SQL> /
    Trigger created.
    SQL> update pavel set txt = 'Two';
    update pavel set txt = 'Two'
    ERROR at line 1:
    ORA-04091: table SCOTT.PAVEL is mutating, trigger/function may not see it
    ORA-06512: at "SCOTT.PAVEL_TRG", line 2
    ORA-04088: error during execution of trigger 'SCOTT.PAVEL_TRG'Message was edited by:
    N. Gasparotto

Maybe you are looking for

  • Oracle Application Server 10.1.3 R3 - Restart problem and out of memory

    Dear All, I am using Oracle App Server 10.1.3 Release 3. After deploying EAR, my server is runnig for some time. But after some time its getting restarted. I m not able to find out its permanent solution. If you see below log, it showing out of memeo

  • Windows 8.1 Explorer 11; Explorer does not open

    I started with windows 8, upgraded to windows 8 pro which installed 8.1.  Explorer 11 started acting up and soon no IE 11.  When I click on Explorer a blank window appears.  All the options are dimmed.  The option I am able to open is favorites which

  • Selecting production version in MRP run

    Hi dudes, our client is having reuirement is he will select the production version irrespective of lot size, but he select the production version at the time of manual creation of process order where it depends on resource(work center used in recipe

  • Intermitte​nt PDF printing with HP 8620

    Inconsistent printing of PDF files (some print - some do not). All PDF files print when using ePrint (HP version of remote printing). Using Laptop. Setup to print and system locks after seeing screen Updated with number of pages printing (percentage

  • Checking if user has selected or deselected a tree node

    Hello, In the event handler of the On Action event of a tree node, I need to decide whether the user has selected the element or deselected it. I thought to use the following: data:  lo_node type ref to if_wd_context_node,          lo_element type re