Informix Error -366: The scale exceeds the maximum precision specified.
Cause and resolution
The scale exceeds the maximum precision specified.
A problem exists with the precision or scale of a DECIMAL or a MONEY data type in this statement. Review all uses of these types. The first should be declared as DECIMAL(p) or DECIMAL(p,s) where p, the precision (total number of digits) is between 1 and 32, and s, the scale (number of digits to the right of the decimal point) is no greater than p. The MONEY type follows the same rules.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-366 is a straightforward DECIMAL/MONEY declaration mistake: precision is the total number of
digits a value can hold, and scale is how many of those digits are allowed after the decimal
point — scale can never exceed precision, since that would mean more digits after the decimal
point than the type allows in total.
- A
DECIMAL(p,s)(orMONEY(p,s)) declaration wheresis greater thanp— the direct, only cause. - Confusing precision and scale's argument order — writing them backwards, since precision
comes first and scale second in the
(p,s)syntax. - Widening a scale requirement (more decimal places) without correspondingly widening precision during a schema change.
Solutions / Resolution
- Ensure scale never exceeds precision, per the official guidance — precision ranges from 1 to 32, and scale must be less than or equal to it.
- Double-check argument order:
DECIMAL(precision, scale), precision first. - When increasing the number of decimal places needed, increase precision by at least as much to keep scale within bounds.
Examples
Scale greater than precision
CREATE TABLE prices (
amount DECIMAL(4,6)
);
-- -366: scale (6) exceeds precision (4)
Fix — increase precision to accommodate the desired scale:
CREATE TABLE prices (
amount DECIMAL(10,6)
);
Confirming argument order
-- DECIMAL(precision, scale) — precision first, scale second
DECIMAL(10,2) -- up to 10 total digits, 2 after the decimal point
Diagnostic Checks
- Check every
DECIMAL(p,s)/MONEY(p,s)declaration fors > p. - Confirm the arguments weren't accidentally reversed (scale written first, precision second).
Related Errors / Related Topics
- -201 — "A syntax error has occurred." The general SQL-parsing-error family this fits into.
Precision is the total digit count, scale is the digits after the decimal point — scale can never
exceed precision, and the syntax order is always DECIMAL(precision, scale).