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: Newbie: Update trigger

Re: Newbie: Update trigger

From: news.green.ch <alessandro_at_franchini-net.com>
Date: Mon, 18 Nov 2002 10:24:17 +0100
Message-ID: <3dd8ad29$1_4@corp.newsgroups.com>


This is correct.
But i still have the problem, that Oracle claims like that:

The following error has occurred:

ORA-04091: Tabelle IASTEST.FC_UTRICHIESTA wird gerade geändert, Trigger/Funktion sieht dies möglicherweise nicht ORA-06512: in "IASTEST.FC_UTRICHIESTA_U_INFOS", Zeile 2 ORA-04088: Fehler bei der Ausführung von Trigger 'IASTEST.FC_UTRICHIESTA_U_INFOS' I am missing somthing ?

Thanx

Alessandro

"Michael Gast" <mig-sm_at_web.de> schrieb im Newsbeitrag news:3DD8AD2B.3040400_at_web.de...
> Hi Alessandro,
>
> news.green.ch schrieb:
> > Hi everyone
> > my name is Alessandro and i'm new to this newsgroup.
> >
> > I have a simple problem. I would like in an update trigger to update a
> > timestamp and moduser field to take trace of the changes to a row.
> > But i having troubles because Oracle says the table is mutating.
> > The trigger is defined like that:
> > CREATE OR REPLACE TRIGGER FC_UTRICHIESTA_U_INFOS BEFORE UPDATE ON
> > IASTEST.FC_UTRICHIESTA
> > FOR EACH ROW
> > BEGIN
> > UPDATE FC_UTRICHIESTA SET MUTADATA = SYSDATE;
> > END;
> > /
>
> What you try to do here is to update all rows in your table each time
> you update one row in your table. So for each updated record in your
> table, your trigger will fire again and try to update all rows .....
>
> Oracle prevents such recursive firing of a trigger and you get the
> 'mutating table' error message.
>
> I assume you want to update the MUTADATA column only for the updated rows:
>
> create or replace trigger FC_UTRICHIESTA_U_INFOS
> after update on IASTEST.FC_UTRICHIESTA
> for each row
> begin
> update FC_UTRICHIESTA
> set MUTADATA = SYSDATE
> where <primary key column> = :new.<primary key column>;
> end;
> /
>
> --
> All emails sent to this address are never read and never will be
> answered. Sorry, but until someone cleans up the spam mess, that's the
> way it has to be.
>
> E-Mails, die direkt an diese Adresse geschickt werden, lese und
> beantworte ich nicht. Ich bedauere diesen Umstand sehr, kenne derzeit
> aber keine bessere Möglichkeit, um die Spam-Flut abzustellen.
>
> Mit freundlichen Grüßen / Best Regards
> Michael Gast
> SEPP MED GmbH
>

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- Received on Mon Nov 18 2002 - 03:24:17 CST

Original text of this message

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