Subject | Referential integrity with triggers |
---|---|
Author | fabrice.aeschbacher@wanadoo.fr |
Post date | 2001-02-27T14:30:44Z |
Hi,
( I hope my post won't be in HTML; posting directly from yahoo web
site )
According to a previous post (from Helen Borrie), it is a better
choice to implement RI with triggers (rather than FK) on "lookup
links", corresponding to low selectivity columns.
Question: how can a (before insert) trigger prevent from inserting an
ORDER if the corresponding CUSTOMER_ID does not exist?
Or: how can a (before delete) trigger prevent from deleting a
CUSTOMER as long as ORDERs still exist?
Does someone have examples?
Fabrice Aeschbacher
mailto:fabrice.aeschbacher@...
( I hope my post won't be in HTML; posting directly from yahoo web
site )
According to a previous post (from Helen Borrie), it is a better
choice to implement RI with triggers (rather than FK) on "lookup
links", corresponding to low selectivity columns.
Question: how can a (before insert) trigger prevent from inserting an
ORDER if the corresponding CUSTOMER_ID does not exist?
Or: how can a (before delete) trigger prevent from deleting a
CUSTOMER as long as ORDERs still exist?
Does someone have examples?
Fabrice Aeschbacher
mailto:fabrice.aeschbacher@...