Re: MUTATING PROBLEM !!! IN DATABASE TRIGGER

From: Tim <Tim_at_home.com>
Date: 1997/11/10
Message-ID: <3467012A.F0A_at_home.com>#1/1


> > I definided a Before delete trigger that performs:
> >
> > DECLARE
> > NO_DELETE exception;
> > Begin
> > raise NO_DELETE;
> > EXCEPTION
> > when NO_DELETE then
> > UPDATE T set HIDDEN_DATE = SYSDATE where rowid = :old.rowid;
> > End;
> >
> > But I receive an ORA-04091: table T is mutating, trigger/function may
> > not see it.
> > > Do you know another possible solution ?
> >

Rather than try and stop the delete, why not let the delete go through, but use the trigger to insert a copy of the deleted record back into the table. for example:

insert into T (colname, colname, colname, hidden_date, ...) values (:old.colname, :old.colname, :old.colname, SYSDATE, ...) etc

I havent tried it, bit it should work as it avoids a direct select or update on the source (mutating) table.

TC

.
.
.
.
.
.
Received on Mon Nov 10 1997 - 00:00:00 CET

Original text of this message