GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  PL/SQL
Go To First  |  Previous Question  |  Next Question 
 PL/SQL  |  Question 65 of 166    Print  
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?

  
Total Answers and Comments: 9 Last Update: December 27, 2008     Asked by: be17be 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Robert
 

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.



Above answer was rated as good by the following members:
swaprath
December 03, 2006 14:20:11   #1  
PAWAN AHUJA        

RE: What is mutating trigger? How do you resolve it?

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

we can resolve it by applying statement lelel trigger.

Regards

Pawan Ahuja


 
Is this answer useful? Yes | No
December 08, 2006 02:34:10   #2  
manikandan        

RE: What is mutating trigger? How do you resolve it?

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.


 
Is this answer useful? Yes | No
January 30, 2007 00:19:43   #3  
vikramssheth Member Since: January 2007   Contribution: 1    

RE: What is mutating trigger? How do you resolve it?
We can override this problem using temporary Table Concept.
 
Is this answer useful? Yes | No
May 08, 2007 16:28:20   #4  
sripri Member Since: July 2006   Contribution: 198    

RE: What is mutating trigger? How do you resolve it?

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.


 
Is this answer useful? Yes | No
May 08, 2007 16:41:42   #5  
Robert Member Since: July 2006   Contribution: 91    

RE: What is mutating trigger? How do you resolve it?

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.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
May 08, 2007 16:48:28   #6  
RajivPrasad Member Since: September 2006   Contribution: 85    

RE: What is mutating trigger? How do you resolve it?

If a trigger body is trying to update dependent tables the best approach in this case to avoid mutating trigger errors would be to make the transactions independent and not associated with triggers which is technically called as autonomous transactions.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
December 11, 2008 06:18:33   #7  
Palaniraman Member Since: December 2008   Contribution: 1    

RE: 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?

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.


 
Is this answer useful? Yes | No
December 23, 2008 15:44:58   #8  
ndrajit.raj Member Since: December 2008   Contribution: 1    

RE: 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?
Mutating table is table which is modified by any DML statement.
It is inconsistent mode and we write row level trigger to solve it.

 
Is this answer useful? Yes | No
December 27, 2008 18:43:53   #9  
imran44 Member Since: December 2008   Contribution: 12    

RE: 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?

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


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape