游标遍历


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

posted @ 2016-01-11 11:04  wangfg  阅读(134)  评论(0编辑  收藏  举报