Home » SQL & PL/SQL » SQL & PL/SQL » Mutating error
Mutating error [message #256165] Fri, 03 August 2007 04:29 Go to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Hai all,

I have two tables like hdr and det. I would like to create the trigger for the situation ' 1.Delete Det table records, if any record is deleting in hdr table 2. Delte hdr table records, if any record is deleting in det table '.

I have created the trigger for both the tables, but i am facing ' Mutating Error'....

Any suggestions please

Arun..
Re: Mutating error [message #256167 is a reply to message #256165] Fri, 03 August 2007 04:35 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Of course you got that with triggers.
You delete a row from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1 which fires trigger that delete rows from tab2 which fires trigger that delete rows from tab1...
Oracle stops at the second step saying you're trying to modify you are currently modifying.

Why using triggers that make things under the cover.
Use a procedure that clearly stated what you want to do.
A procedure to delete a row in tab1 that also deletes all rows from tab2; Another one to do the opposite.
Then you have no more problem and no future problem.

Regards
Michel
Previous Topic: case statment
Next Topic: UPDATE with Order By
Goto Forum:
  


Current Time: Sun Dec 04 16:25:59 CST 2016

Total time taken to generate the page: 0.04500 seconds