Firebird; testing for NULL and equality in practice: IS [NOT] DISTINCT FROM
Posted by jpluimers on 2017/06/14
Boy, I totally missed that this was introduced back then in Firebird 2.0:
In Firebird 2 and higher, you test for null-encompassing equality with DISTINCT. This has already been discussed, but here’s a quick recap. Two expressions are considered:
- DISTINCT if they have different values or if one of them is
NULL
and the other isn’t;- NOT DISTINCT if they have the same value or if both of them are
NULL
.[NOT] DISTINCT always returns
true
orfalse
, neverNULL
or something else. Examples:if (A is distinct from B) then...
if (Buyer1 is not distinct from Buyer2) then...
Splendid!
Source: Testing for NULL and equality in practice
–jeroen
Leave a Reply