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

Home -> Community -> Usenet -> c.d.o.server -> Re: Help with Trigger

Re: Help with Trigger

From: Database Generation Ltd. <datagen_at_dircon.co.uk>
Date: Wed, 10 Mar 1999 19:03:31 +0000
Message-ID: <36E6C203.D3D@dircon.co.uk>


Dear Marc,
Thank you very much - this working very good. Can you help with a little bit complicated one? I have Table1(ColA, ColB, ColC,....)
trigger before delete making a copy of Record into the Table1Copy(ColA, ColB, ColC,...)
All OK.
Next I have Table2(ColA, ColD,...) that linked with the Table1 via the ColA;
I want to create the trigger that will copy Record before delete into the Table2Copy(ColA, ColB,ColD,...) that have the same fields as a Table2 but one field more(ColB) that must be taken from Table1. I try to do this:
create trigger x before delte on Table2 for each row declare

      ColB Number(6,0);
begin

      select ColB into ColB from Table1
      where Table2.ColA = Table1.ColA

insert into Table2Copy values(:old.colA, ColB, :old.ColD, ...); end;
Unfortunately this is not working...
Can you help?
Thank you very much again...
Eugene
Marc Mazerolle wrote:
>
> Why not ?
>
> create trigger x before delete on my_table for each row
> begin
> insert into my_dup_table values(:old.col1, :old.col2);
> end;
> /
>
> This would work fine.
>
> Regards,
>
> Marc Mazerolle
>
> Database Generation Ltd. wrote:
>
> > Dear friends,
> >
> > Is it possible (and if it possible - how) to create the trigger BEFORE
> > delete that will copy the record before delete it into another table
> > with the same structure?
> >
> > Thank you very much in advance.
> > Eugene
Received on Wed Mar 10 1999 - 13:03:31 CST

Original text of this message

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