Subject Re: [firebird-support] Problem with my Trigger
Author Matze
Thank you for this answer, but my Firebird (1.5) doesn't accept this Trigger.

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 6, char 24.
DISTINCT.


----- Original Message -----
From: Leyne, Sean
To: firebird-support@yahoogroups.com
Sent: Tuesday, December 12, 2006 9:45 PM
Subject: RE: [firebird-support] Problem with my Trigger



> I changed my trigger in the following way:
>
> AS
> begin
> if ((new.rbcard <> old.rbcard)
> or (new.anrede <> old.anrede)
> or (new.v_name <> old.v_name)
> or (new.n_name <> old.n_name)
> or (new.telefon <> old.telefon)
> or (new.handy <> old.handy)
> or (new.email <> old.email)
> or (new.comment <> old.comment)
> or (new.bonus <> old.bonus)) then
> new.last_changed = current_timestamp;
> end
>
> but the trigger workes only on some datasets. Sometimes the trigger
does
> not change the last_changed field
>
> Whats wrong now ?

The correct logic should be (FB 1.5 or later)...

begin
if ((new.rbcard IS DISTINCT FROM old.rbcard)
or (new.anrede IS DISTINCT FROM old.anrede)
or (new.v_name IS DISTINCT FROM old.v_name)
or (new.n_name IS DISTINCT FROM old.n_name)
or (new.telefon IS DISTINCT FROM old.telefon)
or (new.handy IS DISTINCT FROM old.handy)
or (new.email IS DISTINCT FROM old.email)
or (new.comment IS DISTINCT FROM old.comment)
or (new.bonus IS DISTINCT FROM old.bonus)) then
new.last_changed = current_timestamp;

end

Sean




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