select lpad (' ', 2 * (x.lvl - 1)) || y.name
from (select rownum rnum, level lvl, childcode
from pstree
start with parentcode = '0' and childcode = '401'
connect by prior childcode = parentcode) x, codename y
where x.childcode = y.code
order by x.rnum;
from (select rownum rnum, level lvl, childcode
from pstree
start with parentcode = '0' and childcode = '401'
connect by prior childcode = parentcode) x, codename y
where x.childcode = y.code
order by x.rnum;
这个你可以参考