Informix Error -217
-217 Column column-name not found in any table in the query
(or SLV is undefined).The name appears in the select list or WHERE clause of this query but is not defined in a table and does not appear as a statement local variable (SLV) definition. Check that the column name or SLV name and the names of the selected tables are spelled as you intended.
If all names are spelled correctly, you are not using the right tables, the database has been changed, or you have not defined the SLV. If the name not found is a reference to a column, that column might have been renamed or dropped. If the name not found represents an SLV and you defined the SLV in the statement, make sure that the SLV definition appears before all other references to that SLV name.
This error message can also appear during the execution of an ALTER TABLE statement when the engine tries to update views that depend on the table.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-217 is the column-level counterpart to -206's table-not-found — extremely common in everyday SQL work, and the official guidance gives a genuinely useful checklist of specific causes to work through.
- A misspelled column name in the
SELECTlist orWHEREclause — the most common, straightforward cause. - A misspelled table name or alias, causing the column to be looked for against the wrong table.
- The wrong table entirely — a similarly-named table that doesn't actually have this column.
- A schema change since the query was written — the column was renamed or dropped.
- A Statement Local Variable (SLV) referenced without being defined, or referenced before its definition in the statement — SLV definitions must appear before any reference to them.
- An
ALTER TABLEtrying to update dependent views whose definitions reference the column being altered, renamed, or dropped on the base table — the official text calls this out as a distinct trigger, separate from an ordinary query. - Case-sensitivity or quoting mismatches, if
DELIMIDENTor similar settings affect how identifiers are matched. - An outdated mental model of the schema — code, comments, or documentation assuming a column exists that was removed or renamed some time ago.
Solutions / Resolution
- Check spelling of column names, table names/aliases, and SLV names against the actual schema, per the official guidance — this resolves the majority of -217 reports.
- Verify the tables actually referenced in the query are the intended ones.
- If the schema changed, update the query to reflect the current column name (after a rename) or account for its removal (after a drop).
- For SLVs, ensure the SLV is actually defined in the statement, and that its definition appears before any reference to it.
- For
ALTER TABLEaffecting dependent views, review and update any view definitions that reference the column being altered, renamed, or dropped — before or as part of theALTER TABLE— since the engine will otherwise fail trying to keep those views in sync. - Query the catalog directly to confirm the actual current column list for the table(s) involved, rather than relying on memory or documentation.
Examples
The straightforward typo
SELECT custmer_name FROM customer;
-- -217: intended "customer_name"
SELECT colname FROM syscolumns c, systables t
WHERE t.tabid = c.tabid AND t.tabname = 'customer';
-- confirms the actual column names
Schema drift breaking an old query
-- Query written when the column was "cust_name"
SELECT cust_name FROM customer;
-- -217 after a later ALTER TABLE renamed it to "customer_name"
SLV referenced before its definition
SELECT total_with_tax FROM orders
WHERE (total_with_tax = total * 1.08) AND total > 100;
-- -217: total_with_tax is used before its SLV definition appears
Fix — define the SLV before referencing it:
SELECT total * 1.08 AS total_with_tax FROM orders
WHERE total > 100;
ALTER TABLE breaking a dependent view
CREATE VIEW active_customer_summary AS
SELECT name, region FROM customer WHERE active = 't';
ALTER TABLE customer DROP COLUMN region;
-- -217: active_customer_summary still references "region"
Update or drop the dependent view before altering the base table's column.
Diagnostic Checks
- Query the catalog for the actual column list:
SELECT c.colname FROM syscolumns c, systables t WHERE t.tabid = c.tabid AND t.tabname = 'customer'; - Review table aliases and joins to confirm the column is being referenced against the correct table.
- Review recent schema change history (
ALTER TABLE RENAME COLUMN,DROP COLUMN) for the table. - For SLV issues, review the statement structure for definition-before-use ordering.
- For
ALTER TABLEfailures, review dependent views for references to the affected column.
Related Errors / Related Topics
- -206 — "The specified table
is not in the database." The table-level sibling in the same "object not found" family. - -201 — "A syntax error has occurred." The general SQL-parsing-error family this fits into.
If this appears during an ALTER TABLE, check dependent views first — that's the specific,
easy-to-overlook trigger the official guidance calls out separately from an ordinary query.