Informix Error -6041: The column number is greater than the number of columns in the table.
Cause and resolution
The column number is greater than the number of columns in the table.
The colnum parameter that was presented to dbnfield() is greater than the total number of columns in the table whose name was passed. If the program was iterating over the column numbers from 0 upward, this return code signals the end of the table. Otherwise, check the number passed; if it was as you intended, either the wrong database is current, or the table has been altered.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-6041 fires when dbnfield()'s colnum parameter exceeds the table's actual column count — per
the archived catalogue, this is the normal end-of-table signal if iterating upward from 0,
otherwise a sign the wrong database is current or the table has been altered.
- Iteration past the last column number, as the normal end signal, per the archived catalogue.
- An out-of-range
colnumvalue outside of iteration, per the archived catalogue, possibly from the wrong current database or an altered table.
Solutions / Resolution
- If iterating column numbers upward from 0, treat this as the end-of-table signal, per the archived catalogue.
- Otherwise, check
colnum, the current database, and whether the table was altered.
Examples
N/A
No specific triggering statement is documented beyond the function-level condition described above.
Diagnostic Checks
- Determine whether this is expected iteration-end, or a genuine out-of-range value.
Related Errors / Related Topics
- -6044 — "The column number is greater than the number of columns in the composite key."
Either the normal end-of-iteration signal, or a colnum that's out of range for the actual table.