select count(1)
  from (select level l
          from t_mps_dfs_file f
         where 1 = 1
           and f.owner = ‘112‘
           and f.status = ‘0‘
         start with f.id = 3
        CONNECT by prior f.id = f.pid) t
 where t.l <= 2
select *
  from (select level l, f.*
          from t_mps_dfs_file f 
         where 1 = 1
           and owner = ‘112‘
           and status = ‘0‘
         start with f.pid = 0
        CONNECT by prior f.id = f.pid) t
 where t.l <= 2
 order by t.l,t.id
原文:http://www.cnblogs.com/wangfg/p/5120500.html