Subject RE: [firebird-support] Before Delete trigger
Author agung wibowo
>How would I check each row of TBL_MTRNS for a match? Could it be done
>using a SELECT statement, ie. SELECT MARKID FROM TBL_MTRNS? And how
>would I stop the delete from occur if there is a match?



Hi,

If I'am not wrong with my understood..

Do you have a foreign key within? If you do, and you aren't make set in ON
DELETE (no action), then this foreign key will check the relation
automatically. No trigger needed. But if you want trigger, you can make
that, like this..



Create exeception no_delete "can not deleted";


CREATE TRIGGER BD_MARKER FOR TBL_MARKER
ACTIVE BEFORE DELETE POSITION 0
AS
BEGIN



If (exists(select markid from tbl_mtrns where
markid=old.markid)) then

Begin

Exception no_delete;

end


END ^

regards

agung






[Non-text portions of this message have been removed]