ORA-04091: table AM is mutating, trigger/function may not see it
I create this trigger:
CREATE OR REPLACE TRIGGER pr_test
after insert ON AM
FOR EACH ROW
declare
appo_pr varchar2(64):= null;
BEGIN
select name
into appo_pr
from AS
where AS_ID=:new.AS_ID;
insert into RM (name) values (appo_pr);
END pr_test;
I insert before a new AS_ID and name in tab AS but when I insert a new record in tab AM I get this error:
ORA-04091: table AM is mutating, trigger/function may not see it
ORA-06512: at PR_TEST", line 11
ORA-04088: error during execution of trigger PR_TEST'
I'd like to create a trigger that when I insert a new record in AM It verify the value in col name of AS and insert this value in col name of AM.
What I wrong in this trigger??
How can I modify it??
Thanks Raf