使用connect by... start with...子句就可以方便地进行hierarchical查询,示例:
select empno, ename, mgr
  from emp
 connect by prior empno = mgr
 start with empno = 1;