Subject Re: [ib-support] expression evaluation
Author Doug Chamberlin
At 12/20/2002 07:58 PM (Friday), Lauri Zoova wrote:
>If i have an after(or before, does not matter) update trigger with the
>following in it:
>if new.field <> old.field then [do something that takes a long time and
>needs to be done only when this field changes]
> evaluates to false when old value is null.
>This seems absurd. Is this a feature or a bug or does some standard say
>that this is the way it should be?
>Again - is there another way to do this?

This is standards-conforming behaviour. (Any operation involving NULL
results in NULL except testing for it.)

An easier way to code the multiple tests is to transfer the values from the
fields into variables declared in your trigger procedure. Assign the
variables from the fields. For each variable, if it is NULL set it to some
out-of-bounds value. Finally, do the normal logic tests you would have
otherwise done but use the variables instead of the fields. That way your
logic is not cluttered up with NULL tests.