Informix Error -26909: The SQL statement has more than 65535 AND or OR conditions in it.
Cause and resolution
The SQL statement has more than 65535 AND or OR conditions in it.
The maximum number of AND or OR conditions in an SQL statement is 65535. Bigger statements take too long to prepare and execute, and can usually be rewritten, often by creating and joining with a temporary table.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26909 fires when an SQL statement contains more than 65535 AND or OR conditions.
- A very large generated WHERE clause, with more than 65535 AND or OR conditions.
Solutions / Resolution
- Put the values or conditions in a temporary table and join to it, per the official guidance.
- Split the statement into several smaller statements.
Examples
Replacing a long OR chain with a join
CREATE TEMP TABLE keys (k INT) WITH NO LOG;
-- load the values into keys, then:
SELECT t.* FROM bigtab t, keys WHERE t.k = keys.k;
Diagnostic Checks
- Count the AND/OR conditions the application generates and compare with 65535.
Related Errors / Related Topics
Related: -26918.
More than 65535 AND or OR conditions — use a temporary table and join instead.