Q

ORA-4091 error with trigger

I have a trigger on a table that has to do an action depending on certain values in the other rows and current row in the table. But I get an ORA-4091 error while doing this. How do I work around this?

I have a trigger on a table that has to do an action depending on certain values in the other rows and current row in the table. But I get an ORA-4091 error while doing this. How do I work around this?
The ORA-4091 is the "mutating trigger" issue and is commonly resolved by abandoning the trigger approach and using a stored procedure instead.

Another option is to use a combination of a "before" trigger to set the context, a row-level trigger to capture the changes to each row, one at a time, and an "after" trigger to apply and commit the changes.

This was first published in October 2005

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close