TO_NUMBER

Description

Converts an input expression to a fixed-point number. For NULL input, the output is NULL.

Arguments

Required:

<expr>

An expression of a numeric, character, or variant type.

Optional:

<format>

The SQL format model used to parse the input expr and return. For more information, see SQL Format Models.

<precision>

The maximal number of decimal digits in the resulting number; from 1 to 38. In Snowflake, precision is not used for determination of the number of bytes needed to store the number and does not have any effect on efficiency, so the default is the maximum (38).

<scale>

The number of fractional decimal digits (from 0 to precision - 1). 0 indicates no fractional digits (i.e. an integer number). The default scale is 0.

Returns

The function returns NUMBER(precision, scale).

  • If the precision is not specified, then it defaults to 38.

  • If the scale is not specified, then it defaults to 0.

To more information check the TO_NUMBER in snowflake documentation.

  1. SSC-EWI-OR0050: Input Expression is out of the range.

  2. SSC-EWI-OR0045: Cast type L and FML is not supported.

  3. SSC-EWI-OR0053: Incorrect input format.

Recommendations

  • No additional user actions are required.

  • If you need more support, you can email us at [email protected]

Last updated