Subject Re: [firebird-support] Re: Why NULL <> NULL ?
Author Paul Vinkenoog
Hi jasajona,

>> If you want to compare for the state as well, you have
>> to modify your code OR use the COALESCE function
>
> if (field1 is null or field1 = field2) then ...
> this statement always returs false even if field1 = null :(

It should resolve to (true or null), which in turn resolves to true.

Are you absolutely sure it returns false (or null)?

If so, please let us now your exact Firebird version (number, Classic
or Superserver, OS) and the complete SQL context (that is, the entire
if... then... begin... end code).

> even this returns always false:
> if (not field1 <> field2) then ...

I think you meant: if not( field1 <> field2 ) then...

And this _should_ return null if one or both fields are null.

As I said, look at the Null guide.

And as others said, use COALESCE. (Its use is described in the Null
guide too).


Greetings,
Paul Vinkenoog