Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How do I avoid Mutating Table Error
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
![]() |
![]() |