Informix Error -26079: CONNECT BY query resulted in a loop.
Cause and resolution
CONNECT BY query resulted in a loop.
A CONNECT BY query is resulting in a cycle/loop. Use CONNECT_BY_ISCYCLE psuedo column to identify the row causing cycle/loop. Change your query to remove the row or use the NOCYCLE keyword to allow the query to skip the row.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26079 fires when a CONNECT BY query's traversal forms a cycle — per the official
guidance.
- The hierarchical data referenced by
CONNECT BYcontains a cycle, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use the
CONNECT_BY_ISCYCLEpseudocolumn to identify the row causing the cycle, per the official guidance, then change the query to remove that row, or - Add the
NOCYCLEkeyword to let the query skip the cycling row, per the official guidance.
Examples
Allowing the query to skip cycles
SELECT emp_id, mgr_id, CONNECT_BY_ISCYCLE
FROM employees
START WITH mgr_id IS NULL
CONNECT BY NOCYCLE PRIOR emp_id = mgr_id;
Diagnostic Checks
- Add
CONNECT_BY_ISCYCLEto the projection list to find the cycling row, and either remove it from the underlying data or addNOCYCLE.
Related Errors / Related Topics
- -26080 — "Generic error in CONNECT BY or Recursive query processing." A related
CONNECT BYerror, a generic processing failure rather than a detected cycle. - -26082 — "CONNECT_BY_ISCYCLE is used without the NOCYCLE keyword." A related
CONNECT BYrestriction, onCONNECT_BY_ISCYCLErequiringNOCYCLErather than an actual detected cycle.
A CONNECT BY query's data formed a cycle — use CONNECT_BY_ISCYCLE to find it, or add
NOCYCLE to skip it.