Informix Error -11028: Division by zero.
Cause and resolution
Division by zero.
This Informix CLI error code is the same as SQLSTATE value 22012. The following functions can return this error code: SQLExecDirect(), SQLExecute(), SQLExtendedFetch(), SQLFetch(), and SQLGetData().
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 division by zero. Change the arithmetic expression so that it does not cause division by zero.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-11028 fires when an arithmetic expression causes division by zero — per the official
guidance, this is the same as SQLSTATE value 22012, returnable by SQLExecDirect(),
SQLExecute(), SQLExtendedFetch(), SQLFetch(), and SQLGetData().
- An arithmetic expression, sent to or returned by the database server, that divides by zero, per the official guidance — the direct, only cause.
Solutions / Resolution
- Change the arithmetic expression so it doesn't divide by zero, per the official guidance.
Examples
A division by zero
SELECT total / discount_count FROM orders WHERE discount_count = 0;
-- -11028: division by zero
Corrected
SELECT total / NULLIF(discount_count, 0) FROM orders;
Diagnostic Checks
- Check every division in the statement, and guard against a zero divisor (e.g. via
NULLIF).
Related Errors / Related Topics
No closely related error codes are cross-referenced for -11028 in this set yet.
An arithmetic expression divided by zero — guard the divisor against zero.