Informix Error -2931: There is an error in the format specification.
Cause and resolution
There is an error in the format specification.
Check the content of the FORMAT string in this statement. It is not correct for the data type; that is, it has characters other than # and . for a numeric column, and it has an incorrect internal length for a DATE column (for example, yyy, which calls for a three-digit year).
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-2931 fires when a FORMAT string in an ATTRIBUTES statement doesn't suit the field's data
type — per the official guidance, this includes characters other than # and . for a
numeric column, or an incorrect internal length for a DATE column (for example, yyy, which
calls for a three-digit year).
- Invalid characters in a numeric column's
FORMATstring (anything besides#and.), per the official guidance — the first named cause. - An incorrect internal length in a
DATEcolumn'sFORMATstring (e.g. a three-digit year), per the official guidance — the second named cause.
Solutions / Resolution
- Check the content of the
FORMATstring against the field's data type, per the official guidance, and correct it.
Examples
An invalid numeric format
ATTRIBUTES
price = unit_price, FORMAT = "$$$.99";
-- -2931: '$' is not a valid FORMAT character for a numeric column
Corrected
ATTRIBUTES
price = unit_price, FORMAT = "###.##";
An invalid DATE format length
ATTRIBUTES
hire_date = hire_date, FORMAT = "mmddyyy";
-- -2931: yyy is a 3-digit year, not a valid DATE length
Corrected
ATTRIBUTES
hire_date = hire_date, FORMAT = "mmddyyyy";
Diagnostic Checks
- Check the
FORMATstring's characters against the field's data type (#/.only for numeric columns; a valid date-length pattern forDATEcolumns).
Related Errors / Related Topics
- -2932 — "Formats may be specified only for float, smallfloat, decimal, or date columns."
A related
FORMAT-clause error, about applyingFORMATto an unsupported data type rather than malforming the format string itself.
The FORMAT string's content doesn't suit its field's data type — correct its characters or
length.