oracle有直接的sql来遍历一颗树的子节点和父节点
遍历一个节点的所有子节点(classid的值就是该节点的值)
select *
from organization_ a
start with a.organizationid = 185137
connect by prior a.organizationid = a.parentorganizationid
遍历一个节点的所有父节点(classid的值就是该节点的值)
select *
from organization_ a
start with a.organizationid = 185137
connect by prior a.parentorganizationid=a.organizationid;
主要区别是classid和parentid 的位置
时间: 2024-10-12 07:01:54