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: Trigger needed

Re: Trigger needed

From: Andy Hassall <andy_at_andyh.co.uk>
Date: Mon, 27 Feb 2006 19:07:12 +0000
Message-ID: <ndj602dq8kvdba4dv2kqci2q1v4bh6vba2@4ax.com>


On Mon, 27 Feb 2006 12:02:56 +0100, "Frank Weber" <frank_at_frankweber.com> wrote:

>I have a database among 6 tables. Each record goes from the main table to 5
>other tables via 1:1 relation. A new record is only inserted once in the
>main table tblPERSN, and the primary key ID_PERSN should become inserted in
>the 5 other tables as a foreign key (ID_PERSI, ...).
>What trigger is right? Insert in tblPERSN must be followed by an insert in
>tblPERSI.
>I think it should look something like that?
>
>AFTER
>INSERT OF ID_PERSN ON myuser.tblPERSN
>NEW AS ID_PERSN
>BEGIN
>Insert into tblPERSI
>Values (ID_PERSI := new.ID_PERSN,,,,,,);
>(... entry for each table)
>END;
>
>Is the trigger right on tblPERSI or does it belong to tblPERSN?

 The trigger goes on the table being inserted into; so on "tblPERSN" would be correct.

-- 
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Received on Mon Feb 27 2006 - 13:07:12 CST

Original text of this message

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