What is mutating trigger? How do you resolve it?If a trigger body is trying to update dependent tables, will it get a mutating error?

Showing Answers 1 - 16 of 16 Answers

PAWAN AHUJA

  • Dec 3rd, 2006
 

Mutating trigger is trigger that is currently being modified by DML opertion.

we can resolve it by applying statement lelel trigger.

Regards

Pawan Ahuja

manikandan

  • Dec 8th, 2006
 

if the trigger attempts to select or modify the table while the trigger has not completed (ie. table is in transition). then mutating trigger error occurs.

 because the table is in middle of a transaction so it causes the trigger to mutate.

you can change the trigger to statement level and apply the logic there.

  Was this answer useful?  Yes

Mutating trigger has similar concept to that of deadlock. When a table is in the half way of executing a transaction and is the owner of a trigger and if the same table is accessed by the trigger somewhere else in the same time then at that instance mutating trigger occurs.

  Was this answer useful?  Yes

To avoid Mutating trigger there are many ways. One of the best approach is to make use of the after trigger which clearly takes care of concurrency problems associated with mutating triggers .When after trigger is used only after the process of current updating is finished the next process gets processed.

Palaniraman

  • Dec 11th, 2008
 

Mutating trigger is trigger that is currently being modified by DML opertion. For eg.,
You created a trigger trigger1 on table1, it should fire after update for each row. And you wrote some update statement on the same table (table1) inside the trigger . When you execute the individual update stmt on table1, the trigger get fires and the trigger also is currently being updated the same rows in table1, which is called mutating error and mutating trigger.

ndrajit.raj

  • Dec 23rd, 2008
 

Mutating table is table which is modified by any DML statement.
It is inconsistent mode and we write row level trigger to solve it.

  Was this answer useful?  Yes

There are cases when we have mutating table error inspite of using an "AFTER TRIGGER at ROW LEVEL".  This happens when you are using an after delete trigger.  For instance a delete was issued and the trigger gets fired.at the same time it also needs the count of the records in the table.  In such a case,it gives a mutation error.  This can be solved by make it a statement level trigger.  Because in such a case, the table count is queried after the delete is fully executed.

  Was this answer useful?  Yes

maxin john

  • Jun 8th, 2015
 

soo...... how you are going to use that lelel trigger :O

  Was this answer useful?  Yes

Lokesh

  • Nov 18th, 2015
 

A mutating table is a table that is being modified by an UPDATE, DELETE, or INSERT statement. The session that issued the triggering statement cannot query or modify a mutating table. If you must update a mutating table, you can bypass these restrictions by using a temporary table, a PL/SQL table, or a package variable. For example, in place of a single AFTER row trigger that updates the original table, resulting in a mutating table error, you might use two triggers—an AFTER row trigger that updates a temporary table, and an AFTER statement trigger that updates the original table with the values from the temporary table.

  Was this answer useful?  Yes

Habib Ali

  • May 10th, 2016
 

When your DML Trigger, tries to modify the same triggering table. Then Mutating issue occurs, to resolve it
1) First try to change the PLSQL Block
OR
1) Change AFTER STATEMENT from ROW LEVEL
2) Make your PLSQL Block of code as AUTONOMOUS TRANSACTION

  Was this answer useful?  Yes

shaik mazhar

  • May 12th, 2016
 

When table 1 is linked to table 2 with a foreign key then you will get Mutation error. The best way to avoid is to use the object oriented oracle terminology or You can avoid by using the combination of row level and statement level trigger, the above method has limitation when roll backed as PL/SQL table type will not purge the data.
So the best method is to use the combination of rowlevel trigger and GTT concept

  Was this answer useful?  Yes

asha

  • Jul 7th, 2016
 

If You are writing a trigger after update on a x table and then writing update statement on same x_table table then It will give Mutating Error statement.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions