NULLIF function in Amazon QLDB
Important
End of support notice: Existing customers will be able to use Amazon QLDB until end of support on 07/31/2025. For more details, see
Migrate an Amazon QLDB Ledger to Amazon Aurora PostgreSQL
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