meta data for this page
  •  

NULL literals allowed as operands

Changed in: 2.0

Description

Before Firebird 2.0, most operators and predicates did not allow NULL literals as operands. Tests or operations like A <> NULL, B + NULL or NULL < ANY(…) would be rejected by the parser. Now they are allowed almost everywhere, but please be aware of the following:

The vast majority of these newly allowed expressions return NULL regardless of the state or value of the other operand, and are therefore worthless for any practical purpose whatsoever.

In particular, don't try to determine (non-)nullness of a field or variable by testing with = NULL or <> NULL. Always use IS [NOT] NULL.

Predicates

The IN, ANY/SOME and ALL predicates now also allow NULL literals where they were previously taboo. Here too, there is no practical benefit to enjoy, but the situation is a little more complicated in that predicates with NULLs do not always return a NULL result. For details, see the Firebird Null Guide, section Predicates.