How to solve mutating table Error? Oracle PL\SQL

What is mutating table Error?

One of the scenario when mutating table errors occurs when Table A is parent to Table B and there are triggers defined on table A trigger a1 and on Table B trigger b1.
Triggers are defined in such way that before insert trigger a1 on A

Mutating table error
before insert trigger b1 on Table B. inside trigger b1 you are trying to check value in parent table if it exits parent field. While in parent Table A triggers are called before insert which having reference to Table B values. this leads to kind of race conditions causing mutating table error.
How to solve mutating table error?
While writing trigger care should be taken that parent table triggers should try to avoid update to child table otherwise mutating table error occur.
There are more scenario which would be covered in next Example you can just read many reference available on Mutating table Error.
just do a google search and read its common PL/SQL error which would face.

second option: Use after insert trigger.
More details: next

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s