How to solove this mutation triggers error

I have a remove after trigger on a table with 2 columns uid and appid

I check after deletion if there is no other entries in this table with the same uid, I update a flag in another table that also has the uid column.

But I get an error of mutation.

Create or replace trigger abc

after deletion on < tab1 >

referencing old as old and new like new

for each line

declare iCount number (9);

Start

Select count (*) from < tab1 > iCount

where uid =:old.uid;

If iCount = 0 then

Update flag set < tab2 > = ' no where uid =:old.uid;

end if;

end;

/

What I'm doing wrong here and how to fix it?

Thank you

YG

end;

Hello

When you create a trigger on a table, you cannot edit/query this table until the trigger/a function completed.

You can use

(1) transaction of Pragma autonomous

(2) instead of row-level trigger, you have statement-level trigger

(3) to 11 g, try with COMPOSITE trigger

Tags: Database

Similar Questions

Maybe you are looking for