Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: NEWBIE: ORA 4091-TRIGGER CANNOT SEE TABLE

Re: NEWBIE: ORA 4091-TRIGGER CANNOT SEE TABLE

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Tue, 2 Mar 1999 21:59:02 +0100
Message-ID: <36dc511e$0$24527@newton>


Jan Rosinowski wrote
>...ora 4091... table is mutation, trigger may not see it...

>cascading triggers shouldn't be too difficult to implement
>for oracle?!

Consider having two records, which you would update both in one statement (that is: the where clause of your statement would not limit the update to only one row). Then the trigger would fire for both the rows, but Oracle does not know (nor does it guarantee) in which order these two rows are updated. If row A is updated first, then A.newest := Yes, and B.newest := False. After this, row B is updated, resulting in B.newest := true and A.newest := false. But what if B was to be updated first? Get the picture? Results would be unpredictable.

To avoid that, you may not read from, or write to a mutating table, which for a trigger also includes the table that the trigger belongs to. The only exception is a FOR EACH ROW insert or update trigger, in which you may *read* the other rows.

Arjan. Received on Tue Mar 02 1999 - 14:59:02 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US