COALESCE#
Evaluates the arguments in order and returns the current value of the first expression that initially does not evaluate to NULL.
Syntax#
COALESCE ( expression [ ,...n ] )
Arguments#
expression
Is an expression of any type.
Return types#
Returns the data type of expression with the highest data type precedence. If all expressions are nonnullable, the result is typed as nonnullable.
Examples#
SELECT COALESCE(NULL, NULL, NULL, 1, 2, 3);