Subject Re: [ib-support] Deleting one way but not another (design help needed)
Author Martijn Tonies

> I have a table B that has a FK constraint to table A on A's ID. B has
> a primary key on ID plus another field so that several records can
> exist in B for one in A. Simple enough. The FK update and delete
> rules are both CASCADE.
> B, however has a BEFORE DELETE trigger that prevents the user from
> deleting some specific records. I want theese records to be
> an "untoched" group.

Assuming this is because the records have specific information that
you can recognize in the trigger...

How about a stored procedure that you call from the application
that first update the B record to remove the criteria and then delete
the A records.

Alternatively, only allow delete's from a stored procedure, removing
the DELETE right from the B table, but grant the stored procedure
the DELETE right to the B table. This makes sure that users, for
whatever reason possible, to delete B records. So instead of using
the trigger, use the procedure to check whether the records can be
deleted and call a different or with special parameters procedure to
delete records from B and A if you need to.

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird

Upscene Productions

"This is an object-oriented system.
If we change anything, the users object."