表结构如下:
Id Parent_id Name
1 A
2 1 B
3 2 C
4 2 D
5 4 E
6 3 F
7 1 G输出如下:
1-------A
2-------B
3-------C
6-------F
4-------D
5-------E
7-------G
本人写了一个存储过程(ORACLE)
create or replace procedure p(v_pid tree.pid%type) is
cursor c is select * from tree where pid = v_pid;
begin
for v_tree in c loop
dbms_output.put_line(v_article.name)
p(v_tree.id);
end loop;
end;有错误
请大家帮帮我 写一个 谢谢
Id Parent_id Name
1 A
2 1 B
3 2 C
4 2 D
5 4 E
6 3 F
7 1 G输出如下:
1-------A
2-------B
3-------C
6-------F
4-------D
5-------E
7-------G
本人写了一个存储过程(ORACLE)
create or replace procedure p(v_pid tree.pid%type) is
cursor c is select * from tree where pid = v_pid;
begin
for v_tree in c loop
dbms_output.put_line(v_article.name)
p(v_tree.id);
end loop;
end;有错误
请大家帮帮我 写一个 谢谢
start with id=1
connect by prior id=Parent_id
/
1 A
2 1 B
3 2 C
4 2 D
5 4 E
6 3 F
7 1 G显示效果:
1-------A
2-------B
3-------C
6-------F
4-------D
5-------E
7-------G
更正一下