Informix Error -1826: DESCRIBE information about this statement is not available at this time.
Cause and resolution
DESCRIBE information about this statement is not available at this time.
When the DEFERRED_PREPARE option is turned on, the description of the statement is not known until the cursor is opened. Therefore, a DESCRIBE can only be executed after an OPEN. If DEFERRED_PREPARE and OPTOFC are both turned on, then the DESCRIBE can happen only after the FETCH, because the OPEN is not executed until the FETCH is executed.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1826 fires when DESCRIBE is attempted before statement description information is actually
available — per the official guidance, with DEFERRED_PREPARE enabled, descriptions aren't
available until the cursor is opened, so DESCRIBE must come after OPEN; if both
DEFERRED_PREPARE and OPTOFC are active, OPEN itself doesn't execute until a FETCH
occurs, pushing the earliest valid DESCRIBE point to after FETCH.
DESCRIBEattempted beforeOPEN, withDEFERRED_PREPAREenabled, per the official guidance — the direct, common cause.DESCRIBEattempted beforeFETCH, with bothDEFERRED_PREPAREandOPTOFCactive, per the official guidance — the deeper case, sinceOPENitself is deferred toFETCHtime.
Solutions / Resolution
- Move
DESCRIBEto afterOPEN, per the official guidance, whenDEFERRED_PREPAREis enabled. - Move
DESCRIBEto afterFETCH, per the official guidance, when bothDEFERRED_PREPAREandOPTOFCare active.
Examples
DESCRIBE too early with DEFERRED_PREPARE
EXEC SQL PREPARE stmt FROM :query_text;
EXEC SQL DESCRIBE stmt INTO sqlda;
-- -1826: with DEFERRED_PREPARE, description isn't available until after OPEN
EXEC SQL DECLARE cur1 CURSOR FOR stmt;
EXEC SQL OPEN cur1;
Corrected
EXEC SQL DECLARE cur1 CURSOR FOR stmt;
EXEC SQL OPEN cur1;
EXEC SQL DESCRIBE stmt INTO sqlda;
Diagnostic Checks
- Check whether
DEFERRED_PREPARE/OPTOFCare active, and confirmDESCRIBEis placed after the corresponding required statement (OPEN, orFETCHif both are active).
Related Errors / Related Topics
No closely related error codes are cross-referenced for -1826 in this set yet.
DESCRIBE was attempted before description information was available — move it after OPEN
(or FETCH, if DEFERRED_PREPARE and OPTOFC are both active).