Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger needed
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 toolReceived on Mon Feb 27 2006 - 13:07:12 CST