Subject Re: [firebird-support] compaing NULL values like NEW,COLUMN and OLD.COLUMN in triggers
Author Helen Borrie
At 03:16 p.m. 27/11/2012, Robert Gilland wrote:
>We need to do a lot of checking in update triggers to check for value changes.
>
>ie if( OLD.FIELD1 <> NEW.FIELD1 )OR( OLD.FIELD2 <> NEW.FIELD2 )THEN
> DO SOMETHING;
>
>However if either value is NULL then the response will be NULL.
>
>Is there an easy way to compare values, taking into account these values may be NULL?

From v.2 onwards you can use the IS [NOT] DISTINCT FROM predicate. (Look it up in the LangUpdate doc.) In 1.0 and 1.5 you're stuck with the multiple predicates.

./hb