coalesce

Description

Return the first non-null argument or null if all are null. All arguments must have the same data type.

Return type

least common generalization skipping variants

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

coalesce( expression ... )

Argument

Type

Required

Multiple

expression

any

Required

Can be multiple

Examples

make_col foo:coalesce(bar, baz, 0)

Create a new column ‘foo’, where for each row, the value of column ‘foo’ is set to the value of column ‘bar’ if it isn’t null, or to the value of column ‘baz’ if it isn’t null, or 0.