Timeline for Why does Casting this string as a decimal fail?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 20, 2021 at 11:39 | comment | added | Eaten by a Grue |
In that case I've already accomplished the display aspect in step one where REGEXP_SUBSTR() is used to extract the number from the string. You can infer that decimal computation is required by the fact that I'm casting as a decimal.
|
|
May 20, 2021 at 5:45 | review | Low quality posts | |||
May 20, 2021 at 7:43 | |||||
May 20, 2021 at 5:45 | comment | added | Rick James | @billynoah - I understood our Question to be talking about display, not storage or further computation. | |
May 20, 2021 at 5:44 | history | edited | Rick James | CC BY-SA 4.0 |
added 98 characters in body
|
May 19, 2021 at 20:33 | comment | added | Eaten by a Grue |
FORMAT(x, 2) returns float, not a fixed point number. This leads to precision issues and results like 18.18 + 9.69 = 27.869999999999997 which is why I'm using CAST() to begin with.
|
|
May 19, 2021 at 20:07 | comment | added | Hannah Vernon♦ | but, why does this fix the issue? | |
May 19, 2021 at 20:02 | review | Low quality posts | |||
May 19, 2021 at 20:07 | |||||
May 19, 2021 at 19:45 | history | answered | Rick James | CC BY-SA 4.0 |