Informix Error -26408: Arithmetic operation resulted in an overflow
Cause and resolution
Arithmetic operation resulted in an overflow
The value is too large, and an overflow has occurred.
ACTION You either sent an arithmetic expression in an SQL statement or prepared statement to a database server, or a database server returned an arithmetic expression. This expression caused an overflow. Change the arithmetic expression so that it does not cause an overflow.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26408 fires when an arithmetic expression's result is too large for its target, overflowing — per the official guidance.
- An arithmetic expression, sent to or returned by the database server, that overflows, per the official guidance — the direct, only cause.
Solutions / Resolution
- Change the arithmetic expression so it doesn't overflow, per the official guidance.
Examples
An arithmetic overflow
SELECT huge_smallint_col * huge_smallint_col FROM tab;
-- -26408: SMALLINT * SMALLINT overflows the result type
Corrected
SELECT CAST(huge_smallint_col AS BIGINT) * huge_smallint_col FROM tab;
Diagnostic Checks
- Check the arithmetic expression's operand and result types, and widen the type or restructure the expression to avoid overflow.
Related Errors / Related Topics
- -11028 — "Division by zero." A related arithmetic-expression error, on division by zero rather than overflow.
An arithmetic expression overflowed its target's range — widen the type or restructure the expression.