Home » SQL & PL/SQL » SQL & PL/SQL » Mutating tables and row level triggers
Mutating tables and row level triggers [message #444774] Wed, 24 February 2010 02:25 Go to next message
moonia.das
Messages: 1
Registered: February 2010
Junior Member
Hi All

I am unable to understand why row level triggers cant be used in mutating tables.Can anyone explain me?I came across the following para while looking for the answer which also I am unable to understand :

If you need to update a mutating table, you could 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.

If you giv an eg it would be better
Thanks
Re: Mutating tables and row level triggers [message #444777 is a reply to message #444774] Wed, 24 February 2010 02:47 Go to previous message
Michel Cadot
Messages: 64153
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Mutating error comes when you try to read or modify the table you are currently modifying.
Why this error?
Because you don't know in which order the rows are modified by your statement and the result of the query/modification inside your trigger may depend on this order and in this case executing twice the same statement with the same data may result in different results which is not acceptable and so the error.

Regards
Michel
Previous Topic: Cultivation in PL/SQL
Next Topic: Avoid & in plsql
Goto Forum:
  


Current Time: Sun Dec 11 06:29:06 CST 2016

Total time taken to generate the page: 0.10132 seconds