Google Groepen ondersteunt geen nieuwe Usenet-berichten of -abonnementen meer. Historische content blijft zichtbaar.

cool 9i feature - order SIBLINGS by ...

5 weergaven
Naar het eerste ongelezen bericht

Thomas Kyte

ongelezen,
10 jul 2001, 10:59:1210-07-2001
aan
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....

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

sc...@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 (tk...@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

Thomas Kyte

ongelezen,
10 jul 2001, 11:14:3910-07-2001
aan
In article <9if58...@drn.newsguy.com>, Thomas says...
>


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

Jonathan Lewis

ongelezen,
10 jul 2001, 13:36:2910-07-2001
aan

Of course, one shouldn't really mention
undocumented features, but the
sys_connect_by_path( ename, '/' )
syntax is also valid in 8.1.7, provided
you have set
_new_connect_by_enabled = true.

(Now I just have to figure out the
other 23 SYS_xxxx functions :)


--
Jonathan Lewis

Host to The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html

Author of:
Practical Oracle 8i: Building Efficient Databases
See http://www.jlcomp.demon.co.uk/book_rev.html

Seminars on getting the best out of Oracle
See http://www.jlcomp.demon.co.uk/seminar.html

Screensaver or Lifesaver: http://www.ud.com
Use spare CPU to assist in cancer research.


Thomas Kyte wrote in message <9if64...@drn.newsguy.com>...

Jonathan Lewis

ongelezen,
10 jul 2001, 14:23:1310-07-2001
aan

I should have started that last post with the
comment:

Thanks very much for the information,
please keep them coming.

One of my gripes about Oracle is that many of
the most useful changes are little things that
are never glamorous enough to make it to the
press releases or 'new features' summaries.

--
Jonathan Lewis

Host to The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html

Author of:
Practical Oracle 8i: Building Efficient Databases
See http://www.jlcomp.demon.co.uk/book_rev.html

Seminars on getting the best out of Oracle
See http://www.jlcomp.demon.co.uk/seminar.html

Screensaver or Lifesaver: http://www.ud.com
Use spare CPU to assist in cancer research.


Jonathan Lewis wrote in message
<994786401.8669.0...@news.demon.co.uk>...


>
>Of course, one shouldn't really mention
>undocumented features, but the
> sys_connect_by_path( ename, '/' )
>syntax is also valid in 8.1.7, provided
>you have set
> _new_connect_by_enabled = true.
>
>(Now I just have to figure out the
>other 23 SYS_xxxx functions :)
>
>
>--
>Jonathan Lewis
>
>

Mark Townsend

ongelezen,
10 jul 2001, 23:42:5810-07-2001
aan
in article 994789199.7832.0...@news.demon.co.uk, Jonathan
Lewis at jona...@jlcomp.demon.co.uk wrote on 7/10/01 11:23 AM:

> One of my gripes about Oracle is that many of
> the most useful changes are little things that
> are never glamorous enough to make it to the
> press releases or 'new features' summaries.

Strangely enough - mine too - and unfortunately it's my job to know what is
or isn't in a release :-) This one got by me. Damn developers.

You may also want to check OTN's Oracle9i Database Daily Feature - see
http://otn.oracle.com/products/oracle9i/daily/Jul10.html and the archive at
http://otn.oracle.com/products/oracle9i/daily/content.html - there are 474
new 'features' in Oracle9i, so the series should be winding up about the
time Oracle10i is ready :-)

Ian Ledzion

ongelezen,
11 jul 2001, 03:13:1611-07-2001
aan
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" <tk...@us.oracle.com> wrote in message
news:9if58...@drn.newsguy.com...

Jim Kennedy

ongelezen,
11 jul 2001, 21:21:1011-07-2001
aan
Yeah. But don't stop the features just because of that! Keep up the great
job people. BTW, I loved your book, Jonathan. Tom, I'm only on page 200 of
your book; but I love it so far.
Jim
"Mark Townsend" <markbt...@home.com> wrote in message
news:B7711953.8C99%markbt...@home.com...
0 nieuwe berichten