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?

    Requires Free Membership to View

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

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.