*nullif

Description: The four *nullif functions – for integers, bigints, doubles and strings, respectively – each return the first argument if it is not equal
to the second. If the arguments are equal, the functions return NULL.

As from Firebird 1.5, use of the internal function NULLIF is preferred.

Warnings

These functions return NULL when the second argument is NULL, even if the first argument is a proper value. This is a wrong result. The NULLIF internal function doesn't have this bug.

i64nullif and dnullif will return wrong and/or bizarre results if it is not 100% clear to the engine that each argument is of the intended type
(NUMERIC(18,0) or DOUBLE PRECISION). If in doubt, cast them both explicitly to the declared type (see declarations below).