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 within a hierarchy:

Re: ordering within a hierarchy:

From: <brendan_o'brien_at_wrightexpress.com>
Date: Thu, 14 May 1998 12:24:26 GMT
Message-ID: <6jenpr$s4b$1@nnrp1.dejanews.com>


Have you tried terminating the command with 'ORDER BY LEVEL, SEQ_NO'? It seems obvious, and maybe I'm missing something, but it seems to me that should work just fine. I tried combining a 'connect by' with an 'order by' on one of my recursive tables and it gave me exactly what I wanted, exactly what you're asking for...

-Brendan

In article <6jcbgm$kr$1_at_nnrp1.dejanews.com>,   ghirshon_at_my-dejanews.com wrote:
>
> I have the following query:
> SELECT LEVEL, SEQ_NO, RPAD(' ', LEVEL *5) || CHILD_ACCOUNT, PARENT_ACCOUNT
> FROM GL_GROUP_BOM
> CONNECT BY PRIOR CHILD_ACCOUNT = PARENT_ACCOUNT
> START WITH PARENT_ACCOUNT = 'STAT_DEPT_EXPSE';
>
> which returns the following...
>
> 1 10 COMP_RELTD_COST STAT_DEPT_EXPSE
> 2 10 55000 COMP_RELTD_COST
> 2 11 55040 COMP_RELTD_COST
> 2 12 55001 COMP_RELTD_COST
> 2 15 55015 COMP_RELTD_COST
> 2 20 55099 COMP_RELTD_COST
> 2 25 55500 COMP_RELTD_COST
> 2 28 55550 COMP_RELTD_COST
> 2 30 55035 COMP_RELTD_COST
> 2 32 55030 COMP_RELTD_COST
> 2 34 55020 COMP_RELTD_COST
> 2 36 55021 COMP_RELTD_COST
> 2 40 55028 COMP_RELTD_COST
> 2 42 55250 COMP_RELTD_COST
> 2 44 55025 COMP_RELTD_COST
> 2 46 55005 COMP_RELTD_COST
> 2 48 55999 COMP_RELTD_COST
> 2 26 55510 COMP_RELTD_COST
> 2 27 55520 COMP_RELTD_COST
> 1 20 OCCUPANCY_COSTS STAT_DEPT_EXPSE
> 2 10 52000 OCCUPANCY_COSTS
> 2 12 52001 OCCUPANCY_COSTS
> 2 14 52010 OCCUPANCY_COSTS
> 2 16 52015 OCCUPANCY_COSTS
> 2 18 52017 OCCUPANCY_COSTS
> 2 20 52004 OCCUPANCY_COSTS
> 2 22 52011 OCCUPANCY_COSTS
>
> within the hierarchy - I would like to be able to sort: note that seq_no's
26
> and 27 are following number 48. I also want to insure that my level one
stays
> in order by sequence number as well.
>
> any suggestions? thanks.
> glenn
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Thu May 14 1998 - 07:24:26 CDT

Original text of this message

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