1.某层级节点
select *
from
(
select *,level le
from tableA
start with id='根节点ID'
connect by 父节点=prior 子节点
)
where le=5
2.叶子节点
select *
from tableA t1
where t1.c_oid not in
(
select distinct t2.c_oid
from tableA t2,t_tableA t3
where t2.c_oid=t3.c_pid
)