Informix Error -1235: Character host variable is too short for the data.
Cause and resolution
Character host variable is too short for the data.
In an ESQL/C program, the program has attempted to fetch a column value into a host variable that is not large enough. Use the DESCRIBE command to find out the sizes of column values.
If this error arises in a 4GL program, note all circumstances and contact IBM Informix Technical Support.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1235 fires in ESQL/C programs when a column value is fetched into a character host variable
that isn't large enough to hold it — per the official guidance, DESCRIBE can be used ahead of
time to determine the actual sizes of column values before fetching.
- A character host variable declared shorter than the actual fetched column value, per the official guidance — the direct, only cause.
- A dynamic/prepared query whose result column sizes weren't checked via
DESCRIBEbefore allocating host variables for it.
Solutions / Resolution
- Use
DESCRIBEto determine the actual sizes of column values before fetching, per the official guidance, and size host variables accordingly. - For 4GL programs (rather than ESQL/C), contact IBM Informix Technical Support, per the official guidance's specific note for that case.
Examples
Checking sizes via DESCRIBE before fetching
EXEC SQL PREPARE stmt FROM :query_text;
EXEC SQL DESCRIBE stmt INTO sqlda;
/* inspect sqlda column lengths, then allocate host variables accordingly */
EXEC SQL DECLARE cur1 CURSOR FOR stmt;
Diagnostic Checks
- Compare the host variable's declared length against the actual fetched column value's
length, using
DESCRIBEoutput if the query is dynamic.
Related Errors / Related Topics
- -1207 — "Converted value does not fit into the allotted space." A related buffer-sizing error, about a converted (non-character) value rather than a fetched character column.
A character host variable is too short for the fetched column value — use DESCRIBE to check
actual sizes before fetching.