mutating, trigger/function may not see it- error during execution of trigger

Posted by mahesh soni on Stack Overflow See other posts from Stack Overflow or by mahesh soni
Published on 2010-06-08T11:12:46Z Indexed on 2010/06/08 12:12 UTC
Read the original article Hit count: 525

Filed under:

CREATE OR REPLACE TRIGGER UPDATE_TEST_280510 AFTER insert on TEST_TRNCOMPVISIT declare V_TRNCOMPNO NUMBER(10);

CURSOR C1 IS SELECT B.COMPNO FROM TEST_TRNCOMPVISIT A, TEST_TRNCOMPMST B, TEST_MEMMAST C WHERE A.COMPNO=B.COMPNO AND B.TRNMEMID=C.MEMID AND C.MEMOS>=1000;

begin open c1; fetch c1 into V_TRNCOMPNO;

UPDATE TEST_TRNCOMPMST SET COMPSTATUS='P', remark='comp is pending due to O/S>1000' WHERE COMPNO=V_TRNCOMPNO AND COMPSTATUS='C'; CLOSE C1;

end;

I have made this trigger and while insert the row in table- TEST_TRNCOMPVISIT it gives following error-

The following error has occurred:

ORA-04091: table TEST.TEST_TRNCOMPVISIT is mutating, trigger/function may not see it ORA-06512: at "TEST.UPDATE_TEST_280510", line 4 ORA-06512: at "TEST.UPDATE_TEST_280510", line 10 ORA-04088: error during execution of trigger 'TEST.UPDATE_TEST_280510'

Kindly suggest over this. MaheshA.....

© Stack Overflow or respective owner

Related posts about oracle9i