COALESCE function

COALESCE returns the first non-NULL element provided.

Signatures

Parameter Type Description
val Any The values you want to check.

Return value

All elements of the parameters for coalesce must be of the same type; coalesce returns that type, or NULL.

Examples

SELECT coalesce(NULL, 3, 2, 1) AS coalesce_res;
 res
-----
   3
Back to top ↑