Search code examples
oracle-databasetriggersora-04091

trigger is giving ORA-04091 error


I have a after insert trigger on table tbl_campboss_report , but it is giving me tbl_campboss_report is mutating, trigger/function may not see it

this is my trigger:

BEGIN
update tbl_campboss_report c set c.units=(select b.units from tbl_campboss_master b where b.details=:new.details); 

END;

Can anyone help me on this?
Thanks in advance


Solution

  • Consider changing the trigger to BEFORE INSERT. You don't need to write UPDATE statement in your trigger. Simply assign the value to the required column.

    :new.units = <value that you get from the query>;