Re: Trigger : table is mutating

From: stan <stan.taylor_at_eds.com>
Date: Fri, 19 Jan 2001 05:34:55 GMT
Message-ID: <3a67d2d6.235643496_at_news>


[Quoted] Try looking up autonomous transactions in Oracle Documentation. I am doing this from memory, but I think if you add PRAGMA AUTONOMOUS_TRANSACTION
in the trigger definition before the BEGIN statement, all your problems will be solved.

On Thu, 11 Jan 2001 17:09:13 +0100, "Jérôme PERRET" [Quoted] <jperret_at_freesurf.fr> wrote:

>Hi,
>
>What I have :
>- A table with a column named MAIN
>
>What I want :
>- Only one record is the main one so only one record as the column MAIN set
>to Y (Yes). Others are set to N (No)
>
>What I tried :
>- A trigger on the table (BEFORE UPDATE FOR EACH ROW) :
>
>BEGIN
> IF UPDATING AND :NEW.main='Y' THEN
> UPDATE AdresseFac_Client SET main='N' WHERE main='Y' AND
>ROWID!=:NEW.ROWID;
> END IF;
>END;
>
>What happened :
>- ORA-04091: table GESCO.ADRESSEFAC_CLIENT is mutating, trigger/function may
>not see it
>
>How can I deal with this problem ?
>
>Jerome
>
>
Received on Fri Jan 19 2001 - 06:34:55 CET

Original text of this message