Informix Error -1207: Converted value does not fit into the allotted space.
Cause and resolution
Converted value does not fit into the allotted space.
A noncharacter value, after conversion to a character string, is too long to fit in the buffer that was provided.
If the conversion was automatic, change the program to provide a larger host variable to receive the string.
If this action was an explicit call to conversion function, pass a larger buffer.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1207 fires when a non-character value, after conversion to a character string, is longer than the buffer provided for it — per the official guidance, this can happen either during an automatic (implicit) conversion or an explicit conversion function call.
- An implicit conversion into a host variable too small for the resulting string, per the official guidance — the direct, common cause for automatic conversions.
- An explicit conversion function call given a buffer too small for the result, per the official guidance's other named case.
Solutions / Resolution
- For automatic conversions, use a larger host variable, per the official guidance.
- For explicit conversion function calls, provide a larger buffer, per the official guidance.
Examples
A host variable too small for the converted value
char buf[5];
EXEC SQL SELECT order_total INTO :buf FROM orders WHERE order_id = 1;
-- -1207: order_total's converted string form doesn't fit in a 5-byte buffer
Corrected
char buf[20];
EXEC SQL SELECT order_total INTO :buf FROM orders WHERE order_id = 1;
Diagnostic Checks
- Check the buffer/host-variable size against the maximum possible length of the converted value's character representation.
Related Errors / Related Topics
- -1208 — "There is no conversion from non-character values to character values." A related, older conversion error (servers prior to Version 4.0), about the conversion not being supported at all rather than the result not fitting.
The converted value's character representation doesn't fit the provided buffer — widen the host variable or buffer.