Informix Error -11062: Invalid column number.
Cause and resolution
Invalid column number.
This Informix CLI error code is the same as SQLSTATE value S1002. The following functions can return this error code: SQLBindCol(), SQLColAttributes(), SQLDescribeCol(), SQLExtendedFetch(), SQLFetch(), and SQLGetData().
The value specified for the argument icol exceeds the maximum number of columns that the cursor defines. Confirm that the column number you are fetching is in the result set of the cursor.
For all functions except SQLGetData(), a column number was 0, exceeded the number of columns in the result set, or exceeded the number of columns that the data source supports. For SQLBindCol(), make sure that the column number does not exceed the maximum number of columns that the data source can support. For SQLColAttributes(), use a descriptor type of SQL_COLUMN_COUNT if the column number is 0 or exceeds the number of columns in the result set. For SQLDescribeCol() and SQLFetch(), make sure that the column numbers are not 0 and do not exceed the number of columns in the result set. For SQLExtendedFetch(), set SQL_USE_BOOKMARKS to SQL_UB_OFF if column 0 is bound, and make sure that the bound column numbers do not exceed the number of columns in the result set.
For SQLGetData(), one of the following problems occurred: (1) The column number was 0 and you either called SQLFetch() to get the data or you set SQL_USER_BOOKMARKS to SQL_UB_OFF, (2) The column number exceeded the number of columns in the result set, or (3) You already called SQLGetData() for the current row. Make sure that you do not call SQLFetch() or set SQL_USER_BOOKMARKS to SQL_UB_OFF if the column number is 0, that the column number does not exceed the number of columns in the result set, and that you have not already called SQLGetData() for the current row.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-11062 fires when a column-number argument (icol) exceeds the cursor's actual column
count — per the official guidance, this is the same as SQLSTATE value S1002, returnable by
SQLBindCol(), SQLColAttributes(), SQLDescribeCol(), SQLExtendedFetch(),
SQLFetch(), and SQLGetData().
- For every function except
SQLGetData(): a column number of0, or one exceeding the result set's or data source's column count, per the official guidance — the first named case. - For
SQLGetData(): a column number of0combined with either having already calledSQLFetch()or having setSQL_USE_BOOKMARKStoSQL_UB_OFF; a column number exceeding the result set's column count; or callingSQLGetData()a second time for the current row, per the official guidance — the second named case.
Solutions / Resolution
- For
SQLBindCol(): confirm the column number doesn't exceed the data source's maximum supported columns, per the official guidance. ForSQLColAttributes(): useSQL_COLUMN_COUNTas the descriptor type if the column number is0or out of range, per the official guidance. ForSQLDescribeCol()/SQLFetch(): confirm column numbers aren't0and don't exceed the result set's column count, per the official guidance. ForSQLExtendedFetch(): setSQL_USE_BOOKMARKStoSQL_UB_OFFonly if column0is bound, and confirm bound column numbers stay within the result set, per the official guidance. - For
SQLGetData(): don't callSQLFetch()or setSQL_USE_BOOKMARKStoSQL_UB_OFFwhen the column number is0; confirm the column number stays within the result set; and don't callSQLGetData()twice for the same row, per the official guidance.
Examples
N/A
No specific triggering statement is documented beyond an out-of-range column number.
Diagnostic Checks
- Check the cursor's actual result-set column count, and confirm
icoldoesn't exceed it.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -11062 in this set yet.
The icol argument exceeded the cursor's actual column count — confirm it's within range.