Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: cool 9i feature - order SIBLINGS by ... and sys_connect_by_path

Re: cool 9i feature - order SIBLINGS by ... and sys_connect_by_path

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 10 Jul 2001 08:14:39 -0700
Message-ID: <9if64v0brg@drn.newsguy.com>

In article <9if58008jt_at_drn.newsguy.com>, Thomas says... >

scott_at_TKYTE901.US.ORACLE.COM> select lpad('*', level, '*' ) || ename ename,   2 sys_connect_by_path( ename, '/' ) path   3 from emp
  4 start with mgr is null
  5 connect by prior empno = mgr
  6 order SIBLINGS by ename DESC
  7 /

ENAME                          PATH
------------------------------ ----------------------------------------

*KING /KING
**JONES /KING/JONES
***SCOTT /KING/JONES/SCOTT
****ADAMS /KING/JONES/SCOTT/ADAMS
***FORD /KING/JONES/FORD
****SMITH /KING/JONES/FORD/SMITH
**CLARK /KING/CLARK
***MILLER /KING/CLARK/MILLER
**BLAKE /KING/BLAKE
***WARD /KING/BLAKE/WARD
***TURNER /KING/BLAKE/TURNER
***MARTIN /KING/BLAKE/MARTIN
***JAMES /KING/BLAKE/JAMES
***ALLEN /KING/BLAKE/ALLEN

14 rows selected.

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Tue Jul 10 2001 - 10:14:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US