1.根据父节点递归查询所有子节点
SELECT distinct LPAD('',2*(LEVEL - 1),'')||ORGCODE AS organCode,
PARENT_CODE AS panrentCode
FROM t_organ
START WITH ORGCODE =父节点编码
CONNECT BY PARENT_CODE = PRIOR ORGCODE ;
2.根据子节点递归查询所有父节点
SELECT distinct LPAD('',2*(LEVEL - 1),'')||ORGCODE AS organCode,
PARENT_CODE AS panrentCode
FROM t_organ
START WITH ORGCODE =父节点编码
CONNECT BY PRIOR PARENT_CODE = ORGCODE ;