Subject | Re: [firebird-support] Triggers and referential integrity |
---|---|
Author | Tim Ledgerwood |
Post date | 2003-10-21T08:51:42Z |
Thanks Martijn!
At 10:47 AM 21/10/2003 +0200, you wrote:
At 10:47 AM 21/10/2003 +0200, you wrote:
>Hi Tim,[Non-text portions of this message have been removed]
>
> > :-) I already make extensive use of domains with check constraints - the
> > primary table has every field except the primary key field as a domain
>with
> > a check constraint.
> >
> > As I said, the problem isn't the Inserts so much as the deletes. In the
> > case of a tax table (we also have three here), how do I prevent the user
> > from deleting a tax type if there are any records in the primary table
>with
> > that tax type?
>
>In a BEFORE DELETE trigger, check to see if there are any rows - in all
>child tables!! - with that particular value. Raise an EXCEPTION and the
>DELETE will be aborted.
>
>
>With regards,
>
>Martijn Tonies
>Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
>Upscene Productions
><http://www.upscene.com>http://www.upscene.com
>
>
>Yahoo! Groups Sponsor
>ADVERTISEMENT
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to the
><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003