Informix Error -9657: Cannot determine the data type of a collection in the given expression.
Cause and resolution
Cannot determine the data type of a collection in the given expression.
The data type of a collection used in the provided expression cannot be determined until run time. Casting the collection to a specific data type usually solves this problem.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9657 fires when the data type of a collection used in an expression can't be determined until run time — per the official guidance.
- A collection expression whose type can only be resolved at run time, per the official guidance — the direct, only cause.
Solutions / Resolution
- Cast the collection to a specific data type, per the official guidance — this usually resolves the problem.
Examples
An ambiguous collection expression
SELECT CARDINALITY(some_expr) FROM tab; -- -9657 if some_expr's collection type is ambiguous
Corrected — casting explicitly
SELECT CARDINALITY(CAST(some_expr AS LIST(INT NOT NULL))) FROM tab;
Diagnostic Checks
- Identify the ambiguous collection expression, and add an explicit CAST to a specific collection type.
Related Errors / Related Topics
- -9654 — "The element types of the collection are not unique; explicit casting is required." A related collection-typing error, on element-type uniqueness rather than the collection's overall type being undeterminable.
The collection expression's type couldn't be determined until run time — cast it to a specific type.