CAST

All functions > CONVERSION > CAST

Returns the given expression casted to the given type.

Syntax

CAST(expr, as_type)
sql

Arguments

ParameterTypeRequiredDescription
exprBIGINTYesThe expression to convert
as_typeTYPEYesThe target data type

Returns

The expression converted to the specified type

Notes

  • Converts a value from one data type to another
  • Supports conversions between numeric types (BIGINT, DECIMAL, DOUBLE)
  • Supports conversions between numeric and string types (VARCHAR)
  • Special handling for ROW and ARRAY types
  • Conversion may fail if the value cannot be represented in the target type
  • NULL values remain NULL after casting
  • Precision may be lost when converting between numeric types
  • Follows SQL standard casting rules
Last update at: 2025/10/13 10:23:46