Informix Error -1226: Decimal or money value exceeds maximum precision.
Cause and resolution
Decimal or money value exceeds maximum precision.
The client is attempting to convert a number into a DECIMAL or MONEY variable. However, the number has more digits to the left of the decimal point than the declaration of the variable allows. Revise the program to assign the converted number to a variable with an appropriate precision.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1226 fires when a number being converted into a DECIMAL/MONEY variable has more digits to
the left of the decimal point than that variable's declared precision allows — per the official
guidance, this is a digit-count problem, distinct from -1200/-1201's magnitude-range errors.
- A
DECIMAL/MONEYvariable declared with fewer integer digits than the value being assigned actually has, per the official guidance — the direct, only cause.
Solutions / Resolution
- Revise the program to assign the converted number to a variable with an appropriate precision, per the official guidance.
Examples
A value with more integer digits than the declared precision
DEFINE v_amount DECIMAL(5,2);
LET v_amount = 123456.78;
-- -1226: 123456 has 6 integer digits, exceeding what DECIMAL(5,2) allows (3 integer digits)
Corrected
DEFINE v_amount DECIMAL(9,2);
LET v_amount = 123456.78;
Diagnostic Checks
- Compare the number of integer digits in the value against the variable's declared precision (accounting for the digits reserved for the fractional part).
Related Errors / Related Topics
- -1200 — "Number is too large for a DECIMAL data type." A related
DECIMALerror, about the type's overall magnitude ceiling rather than a specific variable's declared precision. - -1201 — "Number is too small for a DECIMAL data type." The mirror-image magnitude error.
The value has more integer digits than the target DECIMAL/MONEY variable's declared
precision allows — widen the variable's precision.