select t.org_code,t.parent_code,t.org_name,level
from comm_org_code t
start with t.parent_code = ‘C131’
connect by t.ORG_CODE = prior t.parent_code
order by level desc
–如果prior对应的列为父节点,则是查询父节点,如果对应的是子节点,则是查询子节点
–ORG_CODE parent_code
查询所有父级或者所有子级的sql语句
最新推荐文章于 2023-05-12 15:15:49 发布