oracle遍历树

1:首先数据库中表必须是树形结构的
2:super_department_id  department_id 的父节点编号
3:以下语句的执行结果是:department_id = 88 所有字节点及子子节点的记录
 
select * from pub_department a start with a.department_id = 88 connect by prior a.department_id = a.super_department_id

 

 

 

遍历此节点到祖先节点:

   select * from tree t  connect by prior t.parent= t.child start with t.child='001190360'

遍历此节点到孙子节点:

   select * from tree t  connect by priort.child =t.parent start with t.child='001190360'

posted @ 2016-08-23 16:03  argus_agent  阅读(549)  评论(0编辑  收藏  举报