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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to Sort Subset of Hierarchical Query

Re: How to Sort Subset of Hierarchical Query

From: Mark Malakanov <markmal_at_sprint.ca>
Date: Thu, 30 Sep 1999 23:25:56 -0300
Message-ID: <OPVI3.6448$xJ4.325555@newscontent-01.sprint.ca>


create index parent_child on Table(parent,child);

select /*+index(table parent_child) */
  rpad(' ',level,' ')||child
from table
connect by prior child=parent

Mark Malakanov

Allen <allen_at_ms15.hinet.net> wrote in message news:7t0rvr$3vu_at_netnews.hinet.net...
> Hi,
> Can anyone help me how to sort subset when using
> Oracle Hierarchical Query, For Example:
>
> Table:
> Parent Child Child_Seq
> Contains:
> aaa bbb 300
> bbb ccc 200
> bbb ddd 100
> bbb eee 240
> aaa kkk 210
> SQL Statement:
> select parent, child, child_seq from TABLE start with parent = 'aaa'
> connect by prior child=parent.
> Output:
> aaa bbb 300
> bbb ccc 200
> bbb ddd 100
> bbb eee 240
> aaa kkk 210
>
> But I hope that I can get another result, if same parent, I need to sort
by
> child_seq:
> aaa bbb 300
> bbb ddd 100
> bbb ccc 200
> bbb eee 240
> aaa kkk 210
>
>
>
>
>
>
>
>
>
Received on Thu Sep 30 1999 - 21:25:56 CDT

Original text of this message

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