- Kategorien:
NULLIF¶
Gibt NULL zurück, wenn expr1 gleich expr2 ist, andernfalls wird expr1 zurückgegeben.
Syntax¶
NULLIF( <expr1> , <expr2> )
Argumente¶
expr1Ein beliebiger Ausdruck eines beliebigen Datentyps.
expr2Jeder beliebige Ausdruck, der denselben Datentyp ergibt wie
expr1.
Rückgabewerte¶
Der Datentyp des zurückgegebenen Werts entspricht dem Datentyp von expr1.
Sortierungsdetails¶
The collation specifications of all input arguments must be compatible.
The collation of the result is the same as the collation of the first input.
Beispiele¶
SELECT a, b, NULLIF(a,b) FROM i; --------+--------+-------------+ a | b | nullif(a,b) | --------+--------+-------------+ 0 | 0 | [NULL] | 0 | 1 | 0 | 0 | [NULL] | 0 | 1 | 0 | 1 | 1 | 1 | [NULL] | 1 | [NULL] | 1 | [NULL] | 0 | [NULL] | [NULL] | 1 | [NULL] | [NULL] | [NULL] | [NULL] | --------+--------+-------------+