Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Connect By query question
A copy of this was sent to "Sean Dolan" <nospam_at_nowhere.com> (if that email address didn't require changing) On Thu, 17 May 2001 10:25:56 -0600, you wrote:
>Oracle 8.1.7:
>
>My current query and results:
> select LPAD(' ', 2*(level-1), '-') || display CategoryDisplay, cat_id
> from category
> start with cat_id = 50000095
> connect by prior cat_id = parent_cat_id;
>
there is no syntax for ordering the results of a connect by within levels.
See
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:9212348049
for two approaches to this issue tho...
>Results:
>---------------------------------
>SALES DEPT 50000095
>- Inside Sales 50000117
>--- Product 50000119
>----- monitors 50000503
>----- printers 50000502
>----- computers 50000504
>----- Keyboards 50000505
>--- Service 50000120
>- Outside Sales 50000118
>--- Product 50000121
>--- Service 50000122
>- Computer sales 50000461
>
>GOAL : I am trying to alphabetize each level of the tree so that it would
>come out looking like:
>
>SALES DEPT 50000095
>- Computer sales 50000461
>- Inside Sales 50000117
>--- Product 50000119
>----- computers 50000504
>----- Keyboards 50000505
>----- monitors 50000503
>----- printers 50000502
>--- Service 50000120
>- Outside Sales 50000118
>--- Product 50000121
>--- Service 50000122
>
>
>Question : How do you order just the level within the tree ????
>
>Thanks,
>Sean Dolan
>
>
-- Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries Howtos and such: http://asktom.oracle.com/ Oracle Magazine: http://www.oracle.com/oramag Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Fri May 18 2001 - 10:21:22 CDT