首页 > 代码库 > oracle递归查询

oracle递归查询

查询的表复合递归查询条件,父节点,子节点 table tree

技术分享

SELECT * FROM tree START WITH id = 2 CONNECT BY PRIOR pid = id -- 递归查询父节点  
union  
SELECT * FROM tree START WITH id = 2 CONNECT BY pid = PRIOR id; -- 递归查询子节点  

 

oracle递归查询