Informix Error -1215: Value too large to fit in an INTEGER.
Cause and resolution
Value too large to fit in an INTEGER.
The INTEGER or SERIAL data type can accept numbers with absolute values from 0 through 2,147,483,647 (plus or minus (2 to the 31st power) - 1).
To store numbers that are outside this range, redefine the column or variable to use the BIGINT or BIGSERIAL or INT8 or SERIAL8 data type or the DECIMAL data type. For more information on valid ranges of data types, see the IBM Informix Guide to SQL: Reference.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1215 fires when a value exceeds what INTEGER/SERIAL can hold — per the official guidance,
these types support absolute values from 0 to 2,147,483,647 (±2³¹ - 1).
- A value greater than 2,147,483,647 or less than -2,147,483,647 assigned to an
INTEGER/SERIAL, per the official guidance — the direct, only cause. - A
SERIALcolumn that has exhausted its 32-bit range through accumulated auto-increment values, in a long-running or high-volume table.
Solutions / Resolution
- Use
BIGINT,BIGSERIAL,INT8,SERIAL8, orDECIMALinstead, per the official guidance, if the value genuinely needs a wider range.
Examples
A value beyond INTEGER's range
DEFINE v_total INTEGER;
LET v_total = 5000000000;
-- -1215: 5,000,000,000 exceeds INTEGER's 2,147,483,647 maximum
Corrected — widen the type
DEFINE v_total BIGINT;
LET v_total = 5000000000;
Diagnostic Checks
- Check the actual value against
INTEGER's ±2,147,483,647 range. - For a
SERIALcolumn, check whether it's approaching or has exceeded its 32-bit range from accumulated values.
Related Errors / Related Topics
- -1214 — "Value too large to fit in a SMALLINT." A related type-range error, for
SMALLINTrather thanINTEGER.
The value exceeds INTEGER/SERIAL's ±2,147,483,647 range — use BIGINT/BIGSERIAL/DECIMAL
instead.