Professional Documents
Culture Documents
Mutating Table
Mutating Table
Mutating Table
Answer
#1
A mutating table is a table that is currently being
modified by an update, delete, or insert statement. For
example, if your trigger contains a select statement or an
update statement referencing the table it is triggering off
of you will receive the error.
Another way this error can occur is if the trigger has
statements to change the primary, foreign or unique key
columns of the table the trigger is triggering off of.
For eg:We have two tables "A" and "B". "A" is the master
table and "B" the detail table. We specified a foreign key
between "B" and "A" with the CASCADE DELETE option.
1 row deleted.
SQL> select count(*) from B;
COUNT(*)
----------
0
(PS:It is not always possible to change the row trigger to
a statement trigger. This is just a way of avoiding a
mutating table error , there are many other ways by which
this can be acheived)
Cheers,
SAS
example: