Subject | Re: A trigger before delete.... |
---|---|
Author | johnsparrowuk |
Post date | 2004-03-25T14:04:51Z |
The exception caused by the trigger failing would cause the detail
deletes to be 'undone'. You wouldn't need to do a rollback.
However, why not just use a "foreign key (a) on delete cascade".
Then no need for the trigger!
John
--- In firebird-support@yahoogroups.com, "akestion" <akestion@y...>
wrote:
deletes to be 'undone'. You wouldn't need to do a rollback.
However, why not just use a "foreign key (a) on delete cascade".
Then no need for the trigger!
John
--- In firebird-support@yahoogroups.com, "akestion" <akestion@y...>
wrote:
> Hi evryone,the
>
> I was wondering if i use a trigger before delete a master (in a
> master details relation).
> In order to delete all details before deleting the master.
> exemple :
>
> create table master
> (
> masterID smallint PRIMARY KEY ,
> masterName varchar(30)
> );
>
> create table details
> (
> detailsID smallint PRIMARY KEY ,
> detailsName varchar(30),
> masterID smallint FOREIGN KEY
> );
> ...
> /*delete Operation in a SP : */
> delete from master where masterID = :IDmaster;
> ...
> A trigger fire before delete, for deleting details.
>
> Does if the operation failed, the details be deleted and not the
> master ?
> And so we must use a transaction to enable Rollback !!
>
> Or Does it make the rollback itself, if the operation which fire
> trigger failed ?
>
> Thanks,
>
> Akim