TO_FLOAT
Description
TO_FLOAT
converts STRING input to FLOAT output. If the input does not represent a float number (or the value of the representation is outside of the supported FLOAT range), the function returns NULL.
Supported input column type: STRING. TO_FLOAT
supports the decimal separator and scientific E notation in input strings. Numbers are parsed according to the "en_US.UTF-8" numeric locale. That is, using "." as the decimal separator and "," as the thousands separator. Whitespace is not allowed in the input string.
Output column type: FLOAT.
Syntax
TO_FLOAT ( table.column )
Null handling
If the input value is NULL, the output value is NULL as well.
Example
[1] Valid string to float conversions using fixed point notation. Input strings contain a mix of:
| ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
[2] Valid string to float conversions using scientific E notation. Input strings contain a mix of:
| ||||||||||||||||||
| ||||||||||||||||||
|
[3] These invalid string inputs are mapped to NULL.
| ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
|