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: Phil Cook <pcook_at_iamerica.net>
Date: 1997/05/20
Message-ID: <01bc652c$5f5b0be0$71f9adcd@phil-cook-laptp>#1/1

Venkat,

We have added the following triggers to our tables with the audit columns updated_by and created by;

create or replace trigger x before update on y for each row
begin

    :new.updated_by := user;
    :new.update_date := sysdate;
end;

If you use an audit history table with a foreign key back to the parent table and a trigger that populates the audit table with changes from the parent table then you will get an ora-4091 error which is a mutating table error.

Phil Cook

Venkata Terala <venkata_at_inetnow.net> wrote in article <337CFB5B.2DA8_at_inetnow.net>...
> 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
>
Received on Tue May 20 1997 - 00:00:00 CDT

Original text of this message

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