Oracle 递归树型查询(父子互逆查询)

--子查父(通过子节点向根节点追朔.)
查询〔特下边〕的父节点

select *
from tb_class t
start with t.class_id = '1030107742'
connect by prior t.super_class_id = t.class_id
order by t.tree_level desc

--父查子(通过根节点遍历子节点.)
查询〔特下边〕的子节点:结果

select *
from tb_class t
start with t.class_id = '1030107742'
connect by prior t.class_id = t.super_class_id
order by t.tree_level desc

你可能感兴趣的:(oracle)