Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Ordering Hierarchical Queries
In your select, use lpad with the connect by level to nest it.
For an example, look at how Oracle formats 'explain plan' output in the tuning guide.
hth -
Regards,
jh
Junmin Lin wrote:
>
> Hi,
>
> I have a question about hierarchical queries.
>
> Suppose I have a table:
>
> PARENT NOT NULL VARCHAR2(10)
> CHILD NOT NULL VARCHAR2(10)
> SORT_ORDER NUMBER(5)
>
> I want to do a hierachical query, I could do:
>
> select parent, child, sort_order, level
> from relation
> connect by parent = prior child start with parent = 'A' ;
>
> But, if I want the out put sorted via sort_order and at the same time
> preseved the level.
>
> How should I do it?
>
> Thanks in advance.
>
> Lin Junmin.
-- Jared Hecker | Hecker Welge Associates, Inc. jared_at_hwai.com | *** *****LEGAL NOTICE TO ALL BULK E-MAILERS***** NOTICE TO BULK EMAILERS: Pursuant to US Code, Title 47, Chapter 5, Subchapter II, page 227, any and all non solicited commercial E-mail sent to this address is subject to a download and archival fee in the amount of $500 US. E-mailing denotes acceptance of these terms and this kind of email is being collected and will be reported to authorities and agency for collection.Received on Wed Mar 25 1998 - 00:00:00 CST