Db2 Troubleshooting
SQLCODE -206 column not found
SQLCODE -206: column not found — the SQL names a column the table does not have.
What it means
- After every EXEC SQL, DB2 returns a SQLCODE: 0 means success, +100 means no row found, and negative values mean an error.
Common causes
- Typo in the column name.
- Column renamed in DDL but program not updated.
- Wrong table in the FROM clause.
How to diagnose
- Describe the table: check actual column names.
- Compare with DCLGEN.
How to fix it
- Fix the column name.
- Refresh DCLGEN and recompile after DDL changes.
Example: Refresh DCLGEN after DDL changes
* DDL rename without program update = -206.
* Keep DCLGEN in sync with the catalog.
Stale copybooks cause -206.
Interview tip
- Q: How would you troubleshoot a SQLCODE -206 column not found in production?
- A: I would check the SQLCODE and SQLERRM immediately after the failing statement, reproduce in SPUFI, then apply the specific fix.
Prevention checklist
- Always check SQLCODE after every EXEC SQL statement.
- Log the SQLCODE, SQLSTATE and failing statement for support.
