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: How do I avoid Mutating Table Error

Re: How do I avoid Mutating Table Error

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/05/17
Message-ID: <338006d1.3987603@newshost>#1/1

do you need to insert into the table and create a new record OR do you just want to record who last updated/inserted a record and when?

If it is the latter something like:

create or replace trigger T_trig
on T
before insert or update
for each row
begin
  :new.last_updated := sysdate;
  :new.last_updated_by := user;
end;
/

in a before, for each row trigger will do it.

If the former, let us know and we'll show you how.

On Fri, 16 May 1997 20:27:07 -0400, Venkata Terala <venkata_at_inetnow.net> wrote:

>Hi!
> I need to write some auditing information (like date a record was
>updated and the user name etc) to the table in which the change was
>made. I know this willcause a MUTATING TABLE error. Is there a work
>around for it ? MS SQL Server allows this kind of a change and I need
>to port that application to Oracle with similar functionality.
>
>Any postings on this will be greatly appreciated.
>
>Thank You
>Venkat

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sat May 17 1997 - 00:00:00 CDT

Original text of this message

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