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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Ordering Hierarchical Queries

Re: Ordering Hierarchical Queries

From: Junmin Lin <linjm_at_guomai.sh.cn>
Date: 1998/03/26
Message-ID: <6fdrj6$n7c$1@www.clinux.ml.org>#1/1

Dear Friends:

First thanks very much for your help.

Jonathan Lewis told me a way to do this is create index.

I try create a organization index on the sort_order.

This indeed solve the problem, and the best way upon my knowledge.

But, if I push the problem further. If the (parent, child) are just a code. The actual value has to be lookup
from other reference table. Then, create such an index is not reasonable.

For example, these parent, child are codes for certain category of goods. These category description can be lookup in some other table. I want to print a Hierarchical report such that all category of the same level is sorted by category description.

Peter told me, we can write some recursive procedure. This is a good solution. But, I don't know if there is any better solution, as I believe, Oracle has done the recursive things for us.

Thanks very much for your information in advance.

Lin Junmin.

Junmin Lin wrote in message <6favuq$8rq$1_at_www.clinux.ml.org>...
>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.
>
>
Received on Thu Mar 26 1998 - 00:00:00 CST

Original text of this message

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