Subject Re: Before Update Trigger Question
Author Adam
--- In firebird-support@yahoogroups.com, "radevojvodic" <vrade@...>
wrote:
>
> Hi All,
>
> What is the best way to implement before update trigger that will fire
> only on a change in a specific field.
>
> Rade
>

It will always fire, you need to use an IF statement (and probably a
coalesce if nulls are permitted). You will need to feed in a valid
argument instead of 0 if not a numeric field, eg '' for string.

NULL <> NULL will not return true so will not enter the if statement.

IF ( COALESCE(OLD.SOMEFIELD, 0) <> COALESCE(NEW.SOMEFIELD, 0) ) THEN
BEGIN
-- Do your thing
END