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: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 27 Feb 2006 09:16:06 -0800
Message-ID: <1141060562.220688@jetspin.drizzle.com>


Frank Weber wrote:
> Hi,
>
> 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?
>
> thanks

Is the trigger right is not the question you should be asking. The question I would propose to you to explore, with a copy of Date and Codd by your side is ... "Is the design right?"

1:1 relationships? It strikes me it is not.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Mon Feb 27 2006 - 11:16:06 CST

Original text of this message

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