Informix Error -337
-337 Cannot create view on temporary table table-name.
Views can be created only on permanent tables. The SELECT statement that defines the view in this latest statement contains the name of the temporary table, table-name. If you did not intend to name a temporary table, check the spelling of table-name. See the discussion of error -313 for a way to display the names of all permanent tables in the database.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-337 is another member of the same family as -323 and -336: temporary tables can't back a
view's defining query, because a view is a persistent, catalog-registered object and a temp table
is inherently session-private and never recorded in the persistent catalog.
- A
CREATE VIEWstatement whose definingSELECTreferences a temporary table — the direct, only cause. - A misspelled table name in the view definition that happens to resolve to a same-named temp table instead of the intended permanent table.
- A workflow that builds intermediate results into a temp table and then attempts to wrap a view around it for convenience, not realizing views require a permanent underlying table.
Solutions / Resolution
- Base the view on a permanent table instead, per the official guidance — this is a structural requirement, not something that can be worked around in the view definition itself.
- Verify the table name's spelling if a permanent table was genuinely intended.
- Check
systablesfor permanent tables (tabtype = 'T') to confirm the intended target's actual name:SELECT tabname FROM systables WHERE tabtype = 'T' AND tabname = 'orders'; - If the underlying data genuinely needs to be materialized first, use a permanent table (or a real base table) as the source, rather than a session-scoped temp table.
Examples
Attempting to view a temp table
SELECT * FROM orders WHERE status = 'pending' INTO TEMP recent_orders;
CREATE VIEW recent_orders_view AS SELECT * FROM recent_orders;
-- -337: recent_orders is a temp table
Fix — materialize into a permanent table if a view is genuinely needed:
CREATE TABLE recent_orders_snapshot AS
SELECT * FROM orders WHERE status = 'pending';
CREATE VIEW recent_orders_view AS SELECT * FROM recent_orders_snapshot;
Diagnostic Checks
- Confirm every table referenced in the view's defining
SELECTis permanent, viasystables.tabtype. - Double-check spelling if a permanent table was genuinely intended but a temp table of a similar name exists.
Related Errors / Related Topics
- -323 — "Cannot grant permission on temporary table." The same underlying restriction
applied to
GRANT. - -336 — "Cannot create or drop audit on a temporary table table-name." The same underlying restriction applied to auditing.
Views require a persistent, catalog-registered base table underneath — a temp table can never back one, regardless of the view's own definition.