title: Oracle: Connect By Loop in user data
body: <p>I understand when a loop can occur in Oracle. Theoritically it says if a record is both parent to another node and at the same time it is child to it, then it can enter into a loop.</p>
  
  <p>But I can't catch why my this particular query is running into a loop. </p>
  
  <pre><code>SELECT Empno, Ename, Job
  FROM Emp
  START WITH Empno = 7839
  CONNECT BY PRIOR
  Job='PRESIDENT'
  </code></pre>
  
  <p>Can someone please explain me how this data can result into a loop.
  I made a CONNECT_BY_ISCYCLE check and found that the record looping is KING(President).
  But I still don't understand how can it be possible, as KING is President and I don't see any way in which it is becoming both child and parent to any record in the table.</p>
  
  <p>Please explain me, why this is an error and where is the loop?</p>
  
  <p>Thanks in advance.</p>
  
  <p>FYI, The table is the default EMP table in SCOTT user in Oracle.</p>