Solved

ORA-04091 - Mutation

Posted on 1999-01-08
2
881 Views
Last Modified: 2008-03-06
ORA-04091 - Mutation. Please, I want to make a trigger that update on cascade but this generates the error. Please try to solve this problem using a TRIGGER. OBS: I'm using AFTER UPDATE event.
0
Comment
Question by:vantive
2 Comments
 
LVL 9

Accepted Solution

by:
konektor earned 100 total points
Comment Utility
trigger generate mutation when you try to acces the same table on which is trigger defined

for example  :

CREATE TRIGGER trigger_on_k
AFTER INSERT ON K_TABLE
FOR EACH ROW
BEGIN
  -- some code
  select count(*) from K_TABLE            <- !!!!!! you cannot do it !!!!!!!
  -- some code
END;

you neither can work with views on the table
0
 
LVL 2

Expert Comment

by:dslavin
Comment Utility
The only time that we have gotten the MUTATING TRIGGER error is when a foreign key constraint (such as ON CASCADE) competes with the trigger.

The only solution that we have found for this is to implement the constraint as part of the trigger, thus:

1) Drop the constraint (normally some time of foreign key)
2) Add the code to the trigger(s) that implements the constraint:

   If, for example, it is a foreign key ON CASCADE DELETE relationship, then you will have to delete the child records in a BEFORE DELETE trigger on the parent record, etc.

If this is more helpful than konektor's comments, then please reject his answer and I can post some sample code in a more complete answer of my own.

If this is not the problem, then it might be that you are doing a TABLE update while some of the individual ROWS are in transition.  In this case you should try to modify your trigger so that it is an AFTER UPDATE ON ROW trigger.


0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Format Number Field 10 39
Calculating total percentage per row in Oracle Query 2 37
Oracle Pivot 2 32
JDeveloper 12c for 32 bit 4 34
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now