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: Aviv <ronensh_at_hotmail.com>
Date: 11 Aug 2002 03:16:42 -0700
Message-ID: <f44c6b66.0208110216.6eb61c16@posting.google.com>


Sorry, but I was not clear enough - my vector is stored outside of the database.
I'm working with Java as a client, so the vectore is stored as java.util.Vector and can contain thousands of id's. The application want to 'page' through this vector 10 records par a page. The vector contains the id's at the right order, but when fatching the records using
select * from view where id in (3,756,32,43,54 ..) the return result set hold records at order the optimaizer fatch recrds.

"Billy Verreynne" <vslabs_at_onwe.co.za> wrote in message news:<ait6ce$849$1_at_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.
Received on Sun Aug 11 2002 - 05:16:42 CDT

Original text of this message

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