Subject | Re: [firebird-support] Delete trigger trickery |
---|---|
Author | emel.hu |
Post date | 2005-08-27T10:08:39Z |
sdbeames wrote:
CREATE TRIGGER LEVELS_TG_BD FOR LEVELS
BEFORE DELETE
AS
declare variable ID integer;
begin
select ID from JOBS where LVL = old.LVL
into ID;
if (ID not NULL) then
exception CANT_DELETE_LEVEL ' [ID=' || ID || ']';
end^
If you know what row exists, maybe will found the causer.
eMeL
ps: sorry my terrible english...
> G'day all,Use a 'debug' trick (for examle):
>
> 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.
CREATE TRIGGER LEVELS_TG_BD FOR LEVELS
BEFORE DELETE
AS
declare variable ID integer;
begin
select ID from JOBS where LVL = old.LVL
into ID;
if (ID not NULL) then
exception CANT_DELETE_LEVEL ' [ID=' || ID || ']';
end^
If you know what row exists, maybe will found the causer.
eMeL
ps: sorry my terrible english...