How Can MySQL exact-value arithmetic handle overflow?


MySQL exact-value arithmetic can handle overflow occurs during numerical expression assessment because overflow occurs depends on the range of the operands. The values used in arithmetic expressions changed to other data type can put away the overflow.

For example, after converting the BIGINT Maximum value to DECIMAL while adding 1 to it can handle the overflow as follows −

mysql> Select 9223372036854775807.0 + 1;
+---------------------------+
| 9223372036854775807.0 + 1 |
+---------------------------+
| 9223372036854775808.0     |
+---------------------------+
1 row in set (0.01 sec)

Updated on: 30-Jan-2020

55 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements