According to Snowflake documentation, TRY_TO_NUMBER should return NULL when passed a non-numeric value. However, when passing the string ‘E’, the function returns a 0.
SELECT TRY_TO_NUMBER('E');
Result showing 0 instead of expected NULL
>Solution :
because there is an implicit zero in front and after it:
SELECT TRY_TO_NUMBER('E'),
TRY_TO_NUMBER('1E2'),
TRY_TO_NUMBER('0E'),
TRY_TO_NUMBER('0E0');
gives:
| TRY_TO_NUMBER(‘E’) | TRY_TO_NUMBER(‘1E2’) | TRY_TO_NUMBER(‘0E’) | TRY_TO_NUMBER(‘0E0’) |
|---|---|---|---|
| 0 | 100 | 0 | 0 |
probably much like 010.0 and 10 and 10.0` all parse to the same thing, the zero’s are not required.
But it does seems like a failure of the parser.