Syntax
NULLIF(expr1, expr2)
Notes
If expr1 = expr2, the return value is NULL. Otherwise, the return value is expr1. It is the same as CASE WHEN
expr1 = expr2 THEN NULL ELSE expr1 END. If the arguments are not equal, the value of the two calculations is expr1.
Examples
obclient> SELECT NULLIF('ABC', 123), NULLIF('123',123), NULLIF(NULL, 'abc');
+--------------------+-------------------+---------------------+
NULLIF('ABC', 123) NULLIF('123',123) NULLIF(NULL, 'abc')
+--------------------+-------------------+---------------------+
ABC NULL NULL
+--------------------+-------------------+---------------------+
1 row in set, 1 warning (0.01 sec)