Oracle 11G函数整理(层次函数)

SYS_CONNECT_BY_PATH(column,char)

SELECT LPAD('',2*level-1)||SYS_CONNECT_BY_PATH(ename, '/') path

FROM scott.emp

START WITH empno = '7839'

CONNECTBY PRIOR empno = mgr;

  

PATH

1

 /KING

2

   /KING/JONES

3

     /KING/JONES/FORD

4

       /KING/JONES/FORD/SMITH

5

   /KING/BLAKE

6

     /KING/BLAKE/ALLEN

7

     /KING/BLAKE/WARD

8

     /KING/BLAKE/MARTIN

9

     /KING/BLAKE/TURNER

10

     /KING/BLAKE/JAMES

11

   /KING/CLARK

12

     /KING/CLARK/MILLER

你可能感兴趣的:(Oracle 11G函数整理(层次函数))