'MySql. 1292 Truncated incorrect DECIMAL value:

Mysql 5.7. I have this code in existing (legacy) project:

UPDATE IGNORE someTable` SET `_bigInteger` = IF(CAST(`bigInteger` AS DECIMAL(65,0)) IS NULL, NULL, JSON_ARRAY(CAST(`bigInteger` AS DECIMAL(65,0))));

Please don't ask what the point of "IF" statement here. If the table has some big integer value, like 432846738962985239845762942343875692386, this update generate the warning:

1 row(s) affected, 1 warning(s): 1292 Truncated incorrect DECIMAL value: '432846738962985239845762942343875692386' Rows matched: 1  Changed: 1  Warnings: 1

And as result my stored value looks like this: [4.328467389629851e38], which is bad. I need to have this entire value [432846738962985239845762942343875692386].

Why do I have this warning and this cut?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source