Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Table is mutating trigger/function may not see it

skudJun 10 2020 — edited Jun 10 2020

Hi,

I'm using oracle 12c. I have a trigger TRG1 before insert or update on table T1 and a function F1 to update the table T1. I'm calling the function F1 from Trigger TRG1. i.e

Trigger code:

CREATE OR REPLACE TRIGGER bfo_ins_upd_t1 BEFORE INSERT OR UPDATE ON T1 FOR EACH ROW

…..
IF inserting OR updating THEN
  F1(:oldvalue1,:oldvalue2,:newvalue1);
END IF;

Function:
CREATE OR REPLACE FUNCTION F1(val1 in varchar2,val2 in varchar2,val3 in varchar2)
) RETURN CHAR IS
BEGIN
    update T1 set col1='A' where col2=val1 and col2=val2 and col3=val3;
END;

I'm trying to test in plsql developer ide for updating the value in T1. After I click the post change button. i'm getting this error Table T1 is mutating trigger/function may not see it encountered in function f1.

Thanks

This post has been answered by BEDE on Jun 10 2020
Jump to Answer
Comments
Post Details
Added on Jun 10 2020
3 comments
1,172 views