Scalar function
NULL input/format or negative digits return NULL.
Syntax
Scalar
Arguments
Returns
- Type: STRING
- Possible values: Formatted number.
- NULL behavior: NULL input/format or negative digits return NULL.
Properties
Usage notes
- Integer-digit form uses comma grouping and HALF_UP rounding. NaN/infinities render NaN, Infinity, -Infinity. Pattern parses the positive section before a semicolon.
- Numeric input can be a signed integer, FLOAT, DOUBLE, or DECIMAL with up to 128-bit storage. Patterns support # and 0 digit placeholders, a decimal point, grouping commas, and literal prefixes or suffixes. Only the positive subpattern before a semicolon is used.
- 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.
Examples
Typical behavior
Round a negative number
Limitations
- Other decimal storage widths can raise an error. DECIMAL values with negative scale are printed as their unscaled integer. Very large scales can overflow or require too much memory. Very large floating-point values may return unformatted text.
Last modified on October 15, 2026