oracle树形结构遍历

数据库树形结构,正反遍历

--从Root往树末梢递归
select level ,identity,pid from table_name
  start with identity=475
  connect by prior identity = pid


--从末梢往树ROOT递归
select level ,identity,pid,yylevel from table_name
  start with identity=542
  connect by prior pid = identity

posted @ 2016-09-23 20:20  京沙  阅读(3953)  评论(0编辑  收藏  举报