Re: after update trigger

From: ATAR SEN MITTAL <asmittal_at_ix.netcom.com>
Date: 1995/08/24
Message-ID: <41is7u$loo_at_ixnews6.ix.netcom.com>#1/1


In <41i3sd$315_at_iii2.iii.net> billyoc_at_iii2.iii.net (Billy OConnor) writes:
>
>I need to delete a row if one of the columns is updated to be zero.
>I get the "mutating table error". I've heard it discussed before, but
>can't recall the workaround. This is more or less the idea:
>
>**************************************************
>create or replace trigger test1
>after update on tname
>for each row
> begin
> if :new.col_val = 0
> then delete tname where tname.pkey = :old.pkey;
> end if;
> end;
>/
>**************************************************
>
>Anyone have a quick suggestion?
>
>
The mutation error will come as the table is mutating w.r.t. to the trigger. One way is store rowids of the rows to be deleted in a temp table and after the update is over, delete rows by matching rowids.

Bye
Fm : Upinder Aggarwal Received on Thu Aug 24 1995 - 00:00:00 CEST

Original text of this message