Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Question Unanswered: why this trigger caused ORA-04091: table RTS.ITEM is mutating...

    Hi,
    I created a trigger:
    CREATE OR REPLACE TRIGGER TRIG_ITEM_UPDATE
    AFTER UPDATE OF replenishable ON ITEM
    FOR EACH ROW
    DECLARE
    v_count1 NUMBER(15);
    v_count2 NUMBER(15);
    BEGIN
    IF (:new.replenishable = 1) THEN
    SELECT COUNT(*) INTO v_count1 FROM POSSALES WHERE itemid = :NEW.itemid;
    SELECT COUNT(*) INTO v_count2 FROM APPROVALDETAIL WHERE itemid = :NEW.itemid;
    IF v_count1=0 AND v_count2=0 THEN
    UPDATE ITEM SET newitemflag = 1 WHERE itemid = :NEW.itemid;
    END IF;
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END;

    and when I executed:
    update item set replenishable=1
    where itemid=261432;

    the error is:
    The following error has occurred:

    ORA-04091: table RTS.ITEM is mutating, trigger/function may not see it
    ORA-06512: at "RTS.TRIG_ITEM_UPDATE", line 9
    ORA-04088: error during execution of trigger 'RTS.TRIG_ITEM_UPDATE'


    Details:
    ORA-04091: table RTS.ITEM is mutating, trigger/function may not see it
    ORA-06512: at "RTS.TRIG_ITEM_UPDATE", line 9
    ORA-04088: error during execution of trigger 'RTS.TRIG_ITEM_UPDATE'

    I don't know why, please help me.
    Thanks
    ttemp821

  2. #2
    Join Date
    Jan 2004
    Posts
    370
    Check out the following link:

    http://osi.oracle.com/~tkyte/Mutate/index.html

  3. #3
    Join Date
    Mar 2004
    Posts
    2
    Originally posted by SkyWriter
    Check out the following link:

    http://osi.oracle.com/~tkyte/Mutate/index.html

    Thank you SkyWriter! I have a solution now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •