Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Mutating problem when delete

Re: Mutating problem when delete

From: Zhiping Nie <nie_at_mail.med.upenn.edu>
Date: Thu, 12 Dec 2002 21:12:28 +0000 (UTC)
Message-ID: <slrn3vsavhuts.7a6l.nie@pobox.upenn.edu>


Good question!
I just gave the example to simulate my case. In fact, the t1 is holding
the data from mainframe and then the data will be splitted into several normalized tables. Well, it is the design issue, I am a developer and have to do my work.   

Any idea about my problem?
Thanks,
ZP
>
>> 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
>
Received on Thu Dec 12 2002 - 15:12:28 CST

Original text of this message

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