Monday, September 04, 2006

What is Mutating Table Errors?

Sometimes you may find that Oracle reports a "mutating table error" when your trigger executes. This happens when the trigger is querying or modifying a "mutating table", which is either the table whose modification activated the trigger, or a table that might need to be updated because of a foreign key constraint with a CASCADE policy. To avoid mutating table errors:
  • A row-level trigger must not query or modify a mutating table. (Of course, NEW and OLD still can be accessed by the trigger.)
  • A statement-level trigger must not query or modify a mutating table if the trigger is fired as the result of a CASCADE delete.

No comments: