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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Compiled Trigger throws error

Re: Compiled Trigger throws error

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Thu, 15 Sep 2005 21:15:15 +0200
Message-ID: <dgch83$rce$00$1@news.t-online.com>


Frank van Bortel schrieb:

> Jürg Schaufelberger wrote:
> 

>>Hello
>>
>>I work with oracle 8.1.7 and I wrote the following trigger and
>>compiled it successfully:
>>
>>CREATE OR REPLACE TRIGGER
>> AV_BB_EINZELPUNKT_EXAKTDEF
>> AFTER INSERT OR UPDATE OF ID_ART
>> ON AV_BB_EINZELPUNKT
>> FOR EACH ROW
>> BEGIN
>> IF :NEW.ID_ART IN (0) THEN
>> UPDATE AV_BB_EINZELPUNKT SET ID_EXAKTDEFINIERT = 0;
>> ELSE
>> UPDATE AV_BB_EINZELPUNKT SET ID_EXAKTDEFINIERT = 1;
>> END IF;
>> END;
>>
>>then I executed the SQL statement:
>>
>>UPDATE AV_BB_EINZELPUNKT set id_art = 0
>>where fid = 1;
>>
>>and got the following error
>>
>>FEHLER in Zeile 1:
>>ORA-04091: Tabelle AV_CHA.AV_BB_EINZELPUNKT wird gerade geändert,
>>Trigger/Funktion darf es nicht sehen
>>ORA-06512: in "AV_CHA.AV_BB_EINZELPUNKT_EXAKTDEF", Zeile 3
>>ORA-04088: Fehler bei der Ausführung von Trigger
>>'AV_CHA.AV_BB_EINZELPUNKT_EXAKTDEF'
>>
>>What's wrong ? Any idea ? Thanks for answers.
>>
>>
>>
> 
> 
> You have a "Mutating Table" - standard recipe to avoid that.
> By the way: why do you update *all* records if only (possibly)
> one is updated?!?
> 

You are correct, in my post i've overlooked, that all records were updated. But that is hopefully not the proper logic behind, so, maybe my example is still useful...

Best regards

Maxim Received on Thu Sep 15 2005 - 14:15:15 CDT

Original text of this message

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