TRY_TO_DOUBLE
functionsupportedCore SQL functionsA special version of TO_DOUBLE that performs the same operation (that is, converts an input expression to a double-precision floating-point number), but with error-handling support (that is, if the conversion can’t be performed, it returns a NULL value instead of raising an error). For more information, see Error-handling conversion functions.
Syntax
supportedpartialnot supportednot scored
TRY_TO_DOUBLE( <string_expr> [, '<format>' ] )
Parameters
| Name | Required | Description |
|---|---|---|
expr | required | An expression of a character type. |
format | required | If the expression evaluates to a string, then the function accepts an optional format model. Format models are described at SQL format models. The format model specifies the format of the input string, not the format of the output value. |
Returns
This function returns a value of FLOAT data type. If there is a conversion error, the function returns NULL.
Usage notes
- The function only accepts string expressions.
- Strings are converted as decimal integer or fractional numbers, scientific notation and special values (nan, inf, infinity) are accepted.