Informix Error -9061: A 'SELECT INTO' statement cannot be executed as the last select statement in an ACE report.
Cause and resolution
A 'SELECT INTO' statement cannot be executed as the last select statement in an ACE report.
The SELECT section of the report can contain more than one SELECT statement. The last (or only) one of these statements must produce the rows that are the contents of the report. Any preceding SELECT statements are used to prepare data in temporary tables that the final statement delivers to the report. Change the report specification so that all but the last SELECT statement contain INTO TEMP clauses.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9061 fires when the last (or only) SELECT statement in the report's SELECT section uses an INTO TEMP clause — per the official guidance.
- The final SELECT statement includes an INTO TEMP clause, per the official guidance — the direct, only cause; the last statement must deliver rows to the report, not to a temporary table.
Solutions / Resolution
- Remove the INTO TEMP clause from the last SELECT statement, per the official guidance — only preceding SELECT statements should use INTO TEMP.
Examples
A final SELECT with INTO TEMP
SELECT * FROM orders INTO TEMP temp_orders; -- -9061: this is the last statement
Corrected
SELECT * FROM orders INTO TEMP temp_orders;
SELECT * FROM temp_orders; -- final statement, no INTO TEMP
Diagnostic Checks
- Check the last SELECT statement in the SELECT section for an INTO TEMP clause, and remove it.
Related Errors / Related Topics
- -9059 — "A select statement which is not the final select statement in an ACE report must select into a temporary table." The inverse constraint — every non-final SELECT statement MUST use INTO TEMP.
The final SELECT statement in the report used INTO TEMP, which only preceding statements may do — remove it.