coalesce
function
Applies to: Databricks SQL
Databricks Runtime
Returns the first non-null argument.
Arguments
exprN
: Any expression that shares a least common type across allexprN
.
Returns
The result type is the least common type of the arguments.
There must be at least one argument.
Unlike for regular functions where all arguments are evaluated before invoking the function, coalesce
evaluates arguments left to right until a non-null value is found.
If all arguments are NULL
, the result is NULL
.