create table tree(
id number(10) not null primary key,
name varchar2(100) not null,
super number(10) not null -- 0 is root
);
-- 从子到父
select * from tree start with id = ? connect by id = prior super;
-- 从父到子
select * from tree start with id = ? connect by prior id = super;
-- 整棵树
select * from tree start with super = 0 connect by prior id = super;
ORACLE树查询
最新推荐文章于 2023-08-18 09:35:58 发布