# How Can MySQL exact-value arithmetic handle overflow?

MySQLMySQLi Database

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)
Published on 19-Feb-2018 13:44:09