Informix Error -411
-411 Cannot specify both host variables and descriptor.
This statement has a USING DESCRIPTOR clause, but it also refers to a cursor that was declared with host variables (that is, with SELECT...INTO or INSERT using variables in the VALUES clause). The purpose of both the descriptor structure and host variable names is to specify the location of the data values, and only one method may be used. Review the declaration of the cursor, and settle on a single method of specifying the location of data values.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-411 fires when a statement mixes two mutually exclusive ways of specifying where data values
should go: host variables (as in SELECT ... INTO :var1, :var2 or INSERT ... VALUES (:var1, ...)) and a USING DESCRIPTOR clause (a dynamic SQDA-based mechanism). Both approaches serve
the same purpose — telling the server where to read or write values — so only one is permitted
per statement.
- A dynamic SQL statement combining
USING DESCRIPTORwith a cursor also declared using host variables — the direct, only cause. - Code migrated from a fixed host-variable approach to a dynamic descriptor-based approach (or vice versa) that wasn't fully converted, leaving remnants of both.
- Copy-pasted dynamic SQL boilerplate that included a
USING DESCRIPTORclause without realizing the cursor it's being applied to already uses host variables.
Solutions / Resolution
- Review the cursor declaration and choose a single consistent method, per the official guidance — either host variables throughout, or a descriptor throughout, never both on the same statement.
- For a fully dynamic/generic statement (unknown column count/types at compile time), use
USING DESCRIPTORexclusively. - For a fixed, known statement shape, use host variables exclusively (
SELECT ... INTO :var1, :var2or similar), without a descriptor clause.
Examples
Mixing host variables and a descriptor (disallowed)
EXECUTE stmt1 USING DESCRIPTOR desc1 INTO :var1, :var2;
-- -411: both a descriptor and host variables are specified
Fix — pick one approach:
-- Host-variable approach:
EXECUTE stmt1 INTO :var1, :var2;
-- Descriptor-based approach:
EXECUTE stmt1 USING DESCRIPTOR desc1;
Diagnostic Checks
- Check the statement for both a
USING DESCRIPTORclause and host variables together. - Confirm which approach the surrounding cursor/statement was actually designed around, and remove whichever one doesn't belong.
Related Errors / Related Topics
- -410 — "Prepare statement failed or was not executed." A related dynamic-SQL-lifecycle
error, about the
PREPARE/EXECUTEsequencing rather than a conflicting specification method. - -402 — "Address of a host variable is NULL." Another host-variable-related embedded-SQL error, in this case about pointer validity rather than a conflicting descriptor.
Pick one data-specification method per statement — host variables or a descriptor, never both — and remove leftover remnants of whichever approach was migrated away from.