# Oracle实现递归查询

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; -- 递归查询子节点

SELECT * FROM tree START WITH id in (1, 10) CONNECT BY PRIOR pid = id -- 递归查询父节点
union
SELECT * FROM tree START WITH id in (1, 10) CONNECT BY pid = PRIOR id; -- 递归查询子节点