COALESCE

<< Click to Display Table of Contents >>

Navigation:  Streaming SQL Reference Guide > Basic Building Blocks > Functions > Scalar Functions >

COALESCE

Previous pageReturn to chapter overviewNext page

COALESCE ( <value-expression> {,<value-expression>}... )

The COALESCE function takes a list of expressions (all of which must be of the same type) and returns the first non-null argument from the list. If all of the expressions are null, COALESCE returns null.

Examples

Expression

Result

COALESCE('amy')

amy

COALESCE('amy', null, 'fred')

amy

COALESCE(null, null, 'fred')

fred

COALESCE(null, 2, 5)

2