Skip to main content
Scalar function
Returns NULL when every argument is NULL.

Syntax

Scalar

  • All result alternatives must have compatible types. Matching types are preserved; mixed types may be converted to a common type. Use explicit casts to choose the result type.

Arguments

Returns

  • Type: Common SQL type after conversion of its arguments
  • NULL behavior: Returns NULL when every argument is NULL.

Properties

Usage notes

  • A single argument returns that argument. At least one argument is required.
  • INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
  • Query tools may report a DECIMAL result as DOUBLE or a TIME result as INTEGER. The returned value still keeps its decimal precision and scale, or its time type. A reported type does not convert the value.
  • Deterministic: The same inputs and settings produce the same result.

Examples

Typical behavior

Choose the first available string

Last modified on October 15, 2026