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 - 11 of 11 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

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