Skip to content
Advertisement

ORA-04091 TABLE ODB.EMPLOYEE IS MUTATING, TRIGGER/FUNCTION MAY NOT SEE IT. IS THERE SOMETHING WRONG WITH MY TRIGGER?

Trying to create a trigger when there is an update of Status on Employee Table and capture some values for the record in Employee table and Employee_Header table for that record and send an email. The trigger throws an error.

Advertisement

Answer

You can’t select from a table which is just being changed; it is mutating. Though, as you can use the :new pseudorecord, you can “skip” that error. Also, where rownum > 1 is useless as it is never true. I don’t know what you meant to say by using it.

I see you’ve created columns using double quotes. In Oracle, that’s usually a mistake. Not that it won’t work – it will, but you always have to reference columns using double quotes and match letter case.

Finally, trigger might look like this (read comments within code):

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement