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 ...

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

From: Ian Ledzion <ian.ledzion_at_lgxbow.com>
Date: Wed, 11 Jul 2001 09:13:16 +0200
Message-ID: <9igu9v$srj$1@rex.ip-plus.net>

Thanks a lot, Thomas, this one means I can drop some code from the app which did just that, so one less headache.

Don't stop!

"Thomas Kyte" <tkyte_at_us.oracle.com> wrote in message news:9if58008jt_at_drn.newsguy.com...
> Thought I might post some of the 9i features you probably won't read about
 in
> the press releases (as I find them)....
>
> Order siblings by for CONNECT by statements -- you can order a connect by
 and
> preserve the hirearchy....
>
> scott_at_TKYTE901.US.ORACLE.COM> select lpad('*', level, '*' ) || ename ename
> 2 from emp
> 3 start with mgr is null
> 4 connect by prior empno = mgr
> 5 order SIBLINGS by ename
> 6 /
>
> ENAME
> ------------------------------
> *KING
> **BLAKE
> ***ALLEN
> ***JAMES
> ***MARTIN
> ***TURNER
> ***WARD
> **CLARK
> ***MILLER
> **JONES
> ***FORD
> ****SMITH
> ***SCOTT
> ****ADAMS
>
> 14 rows selected.
>
> scott_at_TKYTE901.US.ORACLE.COM> select lpad('*', level, '*' ) || ename ename
> 2 from emp
> 3 start with mgr is null
> 4 connect by prior empno = mgr
> 5 order SIBLINGS by ename DESC
> 6 /
>
> ENAME
> ------------------------------
> *KING
> **JONES
> ***SCOTT
> ****ADAMS
> ***FORD
> ****SMITH
> **CLARK
> ***MILLER
> **BLAKE
> ***WARD
> ***TURNER
> ***MARTIN
> ***JAMES
> ***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 Wed Jul 11 2001 - 02:13:16 CDT

Original text of this message

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