Informix Error -26085: You cannot have a CONNECT BY query on a join of two or more tables.
Cause and resolution
You cannot have a CONNECT BY query on a join of two or more tables.
The FROM clause of a CONNECT BY query cannot have a join of two or more tables.
For example, the following statements generate an error:
SELECT empid, name, mgrid, deptdesc FROM (employee INNER JOIN department ON employee.deptid == department.deptid) START WITH employee.name = 'David' CONNECT BY PRIOR employee.empid = employee.mgrid;
SELECT * FROM employee, employee AS new CONNECT BY PRIOR employee.empid = new.mgrid;
The following statement is correct:
SELECT empid, name, mgrid FROM employee START WITH employee.name = 'David' CONNECT BY PRIOR employee.empid = employee.mgrid;
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26085 fires when a CONNECT BY query's FROM clause joins two or more tables — per the
official guidance.
- The
FROMclause of aCONNECT BYquery joins more than one table, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use a single table in the
FROMclause of aCONNECT BYquery, per the official guidance.
Examples
An invalid join
SELECT empid, name, mgrid, deptdesc
FROM employee INNER JOIN department ON employee.deptid = department.deptid
START WITH employee.name = 'David'
CONNECT BY PRIOR employee.empid = employee.mgrid;
-- -26085: joins employee and department
Corrected
SELECT empid, name, mgrid
FROM employee
START WITH employee.name = 'David'
CONNECT BY PRIOR employee.empid = employee.mgrid;
Diagnostic Checks
- Check the
CONNECT BYquery'sFROMclause for a join, and rewrite it to reference a single table.
Related Errors / Related Topics
- -26084 — "Cross server objects cannot be referenced in CONNECT BY queries." A
related
CONNECT BYFROM-clause restriction, on cross-server references rather than joining multiple tables.
A CONNECT BY query's FROM clause joined two or more tables — use a single table
instead.