create or replace procedure p(v_empno emp.empno%type,level binary_integer) is
cursor c is
select * from emp where emp.mgr=v_empno;
v_preStr varchar(1024):='';
v_king c%rowtype;
begin
select * into v_king from emp where empno=v_empno;
if(nvl(v_king.mgr,0)=0) then
dbms_output.put_line(v_king.ename);
end if;
for k in 1..level loop
v_preStr:=v_preStr||'****';
end loop;
for v_temp in c loop
dbms_output.put_line(v_preStr||v_temp.ename);
p(v_temp.empno,level+1);
end loop;
end;
cursor c is
select * from emp where emp.mgr=v_empno;
v_preStr varchar(1024):='';
v_king c%rowtype;
begin
select * into v_king from emp where empno=v_empno;
if(nvl(v_king.mgr,0)=0) then
dbms_output.put_line(v_king.ename);
end if;
for k in 1..level loop
v_preStr:=v_preStr||'****';
end loop;
for v_temp in c loop
dbms_output.put_line(v_preStr||v_temp.ename);
p(v_temp.empno,level+1);
end loop;
end;