Informix Error -1820: The host variable type was changed between fetches or puts.
Cause and resolution
The host variable type was changed between fetches or puts.
If the host variable is used for user-defined-data-type columns or if the host variable itself is a user-defined-data-type host variable, the host variable type and length cannot be changed between fetches or puts.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1820 fires when a host variable used for a user-defined-data-type column (or that is itself a UDT) has its type or length modified between consecutive fetch/put operations — per the official guidance, these attributes must remain consistent throughout.
- The host variable's type or length changed between fetch/put calls, per the official guidance — the direct, only cause.
Solutions / Resolution
- Keep the host variable's type and length consistent throughout the sequence of fetches/puts, per the official guidance — don't redeclare or reinterpret it mid-sequence.
Examples
N/A
No specific triggering statement is documented — check for a redeclaration or reinterpretation of the host variable's type/length between consecutive fetch/put calls.
Diagnostic Checks
- Trace the host variable's type and length across the fetch/put sequence, confirming neither changed partway through.
Related Errors / Related Topics
- -1821 — "Host variable is not large enough to hold the data returned from the server." A related UDT host-variable error, about insufficient allocated size rather than a mid-sequence type change.
The host variable's type/length changed mid-sequence between fetches/puts — keep it consistent throughout.