COALESCE_FUNC

All functions > CONDITIONAL > COALESCE_FUNC

Returns the first non-NULL value from a list of values

Syntax

COALESCE_FUNC(values: ARRAY<T>) → T
sql

Type Parameters:

  • T: Any expression type

Arguments

ParameterTypeRequiredDescription
valuesARRAY<T>YesArray of values to evaluate

Returns

Same type as input values - returns the first non-NULL value, or NULL if all values are NULL

Notes

  • Evaluates values in order from left to right
  • Returns immediately upon finding the first non-NULL value
  • Returns NULL only if all values are NULL
  • All values must be of the same or compatible types
  • Commonly used to provide default values for NULL columns

Examples

Last update at: 2025/10/13 10:23:46