| Subject | Re: Before Update Trigger Question | 
|---|---|
| Author | Adam | 
| Post date | 2006-05-26T06:57:50Z | 
--- In firebird-support@yahoogroups.com, "radevojvodic" <vrade@...> 
wrote:
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
            wrote:
>It will always fire, you need to use an IF statement (and probably a
> Hi All,
>
> What is the best way to implement before update trigger that will fire
> only on a change in a specific field.
>
> Rade
>
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