NULLIF function in Amazon QLDB - Amazon Quantum Ledger Database (Amazon QLDB)

NULLIF function in Amazon QLDB

In Amazon QLDB, given two expressions, use the NULLIF function to return NULL if the two expressions evaluate to the same value. Otherwise, this function returns the result of evaluating the first expression.

The NULLIF function doesn't propagate NULL and MISSING.

Syntax

NULLIF ( expression1, expression2 )

Arguments

expression1, expression2

The two field names or expressions that the function compares. These parameters can be any of the supported Data types.

Return type

Any supported data type. The return type is either NULL or the same as the type of the first expression.

Examples

NULLIF(1, 1) -- null NULLIF(1, 2) -- 1 NULLIF(1.0, 1) -- null NULLIF(1, '1') -- 1 NULLIF([1], [1]) -- null NULLIF(1, NULL) -- 1 NULLIF(NULL, 1) -- null NULLIF(null, null) -- null NULLIF(missing, null) -- null NULLIF(missing, missing) -- null -- Runnable statements SELECT NULLIF(1, 1) FROM << 0 >> -- null SELECT NULLIF(1, '1') FROM << 0 >> -- 1

Related functions