初始的树形数据状态:
|--2(0)--4(100)
0--1(0)--|
|--2(100)--4(100)
0--1(300)--|
|--3(200)--5(200)
create table t
(
id number,
parent_id number,
value number
);
insert into t values(1,0);
insert into t values(2,1,0);
insert into t values(3,0);
insert into t values(4,2,100);
insert into t values(5,3,200);
commit;
sql> select * from t order by id asc;
ID PARENT_ID VALUE
---- ---------- ----------
1 0 0
2 1 0
3 1 0
4 2 100
原文链接:https://www.f2er.com/oracle/211043.html|--2(0)--4(100)
0--1(0)--|
|--3(0)--5(200)
|--2(100)--4(100)
0--1(300)--|
|--3(200)--5(200)
create table t
(
id number,
parent_id number,
value number
);
insert into t values(1,0);
insert into t values(2,1,0);
insert into t values(3,0);
insert into t values(4,2,100);
insert into t values(5,3,200);
commit;
sql> select * from t order by id asc;
ID PARENT_ID VALUE
---- ---------- ----------
1 0 0
2 1 0
3 1 0
4 2 100
5 3 200