Informix Error -1818: Input variable type does not match collection or row definition.
Cause and resolution
Input variable type does not match collection or row definition.
Certain data types cannot be cast on the client. The following situations return this error:
* Trying to cast any complex type into any other complex type (that is, casting a set into list)
* Trying to cast a built-in type (for example, INT) into a complex type
* Trying to cast a complex type into a user-defined data type
* Trying to cast a built-in type into a user-defined data type
Check the SQL statement and make sure the types are compatible.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1818 fires when an incompatible type conversion is attempted involving a complex type — per
the official guidance, this covers casting one complex type to another (e.g. SET to LIST),
a built-in type to a complex type, a complex type to a user-defined type, or a built-in type to
a user-defined type.
- Casting between two different complex types (e.g.
SETtoLIST), per the official guidance — the first named case. - Casting a built-in type to a complex type, per the official guidance — the second named case.
- Casting a complex type to a user-defined type, per the official guidance — the third named case.
- Casting a built-in type to a user-defined type, per the official guidance — the fourth named case.
Solutions / Resolution
- Review your SQL statement and ensure all data types involved in the operation are compatible with one another, per the official guidance.
Examples
An incompatible complex-type cast
SELECT CAST(item_set AS LIST(INTEGER NOT NULL)) FROM orders WHERE order_id = 1;
-- -1818: item_set is a SET, not directly castable to LIST this way
Diagnostic Checks
- Identify the specific source and target types involved in the failing conversion, and check them against the four documented incompatible-cast categories.
Related Errors / Related Topics
- -1815 — "No type information for collection or row is available." A related complex-type error, about a missing type declaration rather than an incompatible conversion.
- -1816 — "No such column exists in the collection or row." A related complex-type error, about a field-name mismatch.
An incompatible type conversion was attempted involving a complex or user-defined type — check source and target type compatibility.