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
DA Morgan - 27 Feb 2006 17:16 GMT
> Hi,
>
[quoted text clipped - 18 lines]
>
> 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.

Signature
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
Andy Hassall - 27 Feb 2006 19:07 GMT
>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
[quoted text clipped - 14 lines]
>
>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.

Signature
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Mark C. Stock - 28 Feb 2006 02:27 GMT
: >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
[quoted text clipped - 17 lines]
: The trigger goes on the table being inserted into; so on "tblPERSN" would be
: correct.