ORA-01436: CONNECT BY loop in user data
When we execute a hierarchical query, it throws an error as ORA-01436 due to data present is not matched and caused error:
Error
select empno, ename, sys_connect_by_path(ename,' -> ') tree from emp connect by prior empno=mgrno;
ORA-01436: CONNECT BY loop in user data
Solution
To trace this error of Connect by loop using connect_by_iscycle, we may execute following query:
select emp.*, connect_by_iscycle from emp where connect_by_iscycle = 1 connect by nocycle prior empno=mgrno;
It will give you the fault rows.