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: select order by my_outside_order

Re: select order by my_outside_order

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Thu, 8 Aug 2002 09:25:01 +0200
Message-ID: <ait6ce$849$1@ctb-nnrp2.saix.net>


"Aviv" <ronensh_at_hotmail.com> wrote

> I want the query to return the records in the order of appearance at
> the vector,

If I understand correctly...

Problem. ID is numeric but not sequential and thus can not be ordered by. Select must return the ID's in the correct vector sequence.

Solution. The vector table needs to have a sequential numbering sequence to number the ID's into the correct sequence for a vector.

E.g.
SELECT seq, id FROM vector ORDER BY seq

SEQ ID
----- ----

1      99
2      98
3      97
4      96
5      95
6      94
7      93
8      92
9      91
10     90

I can not see how you can do it any other way. If Codd's basic design rules have been followed, then the need for this sequence would have been clearly identified.

The bottom line is that you can only order by data that is there - and if you do not know the sequence of the ID's in a vector, there is no way in hell that Oracle can magically know what the order should be.

--
Billy
Received on Thu Aug 08 2002 - 02:25:01 CDT

Original text of this message

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