Subject | RE: [firebird-support] Delete trigger trickery |
---|---|
Author | Alan McDonald |
Post date | 2005-08-27T05:23:51Z |
> G'day all,you'll always be able to select 1 from a table.
>
> Is there anything wrong with this trigger....
>
> CREATE TRIGGER LEVELS_TG_BD FOR LEVELS
> BEFORE DELETE
> AS
> begin
> if (exists(select 1 from JOBS where LVL = old.LVL)) then
> exception CANT_DELETE_LEVEL;
> end^
>
> The exception fires every time I try to delete a row from LEVELS,
> even when there's patently no JOBS entry using that LEVEL.
>
> Thanks,
> Steve
> FB 1.5.2.4731
Try
select first 1 from JOBS
Alan