Subject Re: [firebird-support] On Delete triggers and referential integrity
Author Martijn Tonies
Hi Tim,

> I am busy developing an accounts package in Firebird. Because of the
nature
> of the application, I have decided to institute strict referential
> integrity, and have started by creating tables with foreign keys, cascade
> updates, etc., etc., etc.
>
> In Sybase, I could write a trigger that would fire before a delete, that
> would check to see if there were any records dependant on the FK. If there
> were, it could prevent the delete and pass the user an error message.
>
> How would I do the same in FB?

Well, you CAN write a BEFORE DELETE trigger - but on the
other hand, a FK will allow you to raise an error if there's a
detail record as well. This, btw, is the default.


With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com