oracle 树状查询中的 prior

刚接触树状查询的时候,总对树状查询中的 prior 很迷惑,其实 prior 用处很简单

决定树的遍历方向

树向父结节点方向生长:

select * from bss_org connect by  bss_org_id= prior bss_parent_org_id start with bss_org_id=876

树向子结点方向生长:

select * from bss_org connect by prior bss_org_id=  bss_parent_org_id start with bss_org_id=1

Posted by bigzhu Aug 19, 2010 09:57:59 PM