TRY_TO_DECFLOAT
functionsupportedCore SQL functionsA special version of TO_DECFLOAT that performs the same operation — that is, converts an input expression to a DECFLOAT — but with error-handling support. 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_DECFLOAT( <string_expr> [ , '<format>' ] )
Parameters
| Name | Required | Description |
|---|---|---|
expr | required | An expression of a numeric, character, or Boolean type. |
'format' | optional | If the expression evaluates to a string, the function accepts an optional format model. For more information, see 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 DECFLOAT data type. If there is a conversion error, the function returns NULL.
Usage notes
- The special values 'NaN' (not a number), 'inf' (infinity), and '-inf' (negative infinity) aren’t supported.