I have an after update trigger (Trigger A) on table A which can make changes to table B.
I also have an after update trigger (Trigger B) on table B, which makes no changes, but queries table A to some sanity checking on a denormalization.
So Trigger B can fire one of two ways:
- if I'm directly updating table B, or
- if I update table A and Trigger A fires, causing an update to table B.
In case 2, I get an ORA-04091: table name is mutating, trigger/function may not see it error. This seems correct.
I want to check within Trigger B if table A is "in a bad state" and early exit (the sanity checks wouldn't need to run in this case).
What is the best way to test this within my trigger? Just add an exception handler which swallows the exception? Is there anything more graceful?