Path: news.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeed.news2me.com!canoe.uoregon.edu!logbridge.uoregon.edu!news-west.eli.net!not-for-mail
Message-ID: <3DF8E013.7FA3F995@exesolutions.com>
From: damorgan <damorgan@exesolutions.com>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.misc
Subject: Re: Mutating problem when delete
References: <slrn3vsavhivd.9th3.nie@pobox.upenn.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 45
Date: Thu, 12 Dec 2002 19:14:39 GMT
NNTP-Posting-Host: 156.74.250.7
X-Complaints-To: yvonne.tracy@ci.seattle.wa.us
X-Trace: news-west.eli.net 1039720479 156.74.250.7 (Thu, 12 Dec 2002 12:14:39 MST)
NNTP-Posting-Date: Thu, 12 Dec 2002 12:14:39 MST
Organization: City of Seattle NewsReader Service
Xref: newsfeed1.easynews.com comp.databases.oracle.misc:90484
X-Received-Date: Thu, 12 Dec 2002 12:22:20 MST (news.easynews.com)

Zhiping Nie wrote:

> My environment:Win2k & Oracle 9i2.
>
> There are two tables T1, T2 which have similar structure.
>   T1                 T2
> -------         -------------
>    c1                c1
>    c2                c2
>    c3
>
> What I want to do is:
> whenever T1 gets a row in,
> T2 will get same row, and then the row in T1 will be deleted.
>
> Here is the example code:
> create trigger t1_trigger
> before insert on t1
> on each row
> referencing new as new old as old
> begin
> insert into t2 values(:new.c1, :new.c2);
> end;
>
> create trigger t2_trigger
> after insert on t2
> on each row
> referencing new as new old as old
> begin
> delete from t1 where c1=:new.c1;
> end;
>
> Is it possible to get it done?
> Thanks in advance!
>
> ZP

Why? Why not just insert the row directly into t2? All it appears to me
you are doing is making a simple task difficult, unscalable, and error
prone as you have discovered.

It is not that it can't be done. But why bother?

Dan Morgan

