Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: sql query find rows included in a list: 2nd row , 8th..
What you are attempting to do is not supported in a true RDBMS, since the row number is a pseudo-variable and only counts the number of the row returned by the query...it has absolutely no relation to the 'rank' of the data row ( this is primarily a ' flat file database' concept) - one way to do what you want is to assign a sequence number to each row, index it by the sequence number, and place these numbers in your ArrayList...
( for new rows, you can set up a trigger to automatically set the sequence number)
<ChristineL_at_Visionyze.com> wrote:
>Hi,
>
>I want to select in a big table the rows where the rank specified in a
>ArrayList.
>For example: ArrayList list = {1, 5, 100, 104, 10000}. (1 means the
>first row, 5 means the 5th rows,...).
>The database can be very big and I need a rapid access.
>
>Example: List = {1, 3}
>table
>a aaa <--
>b bbb
>c ccc <--
>...
>the result is: a aaa
> c ccc
>
>At this moment, I read the rows 1 by 1 in a loop with an index and when
>the index is included in my ArrayList, I keep this row. The problem with
>this solution: Too slow with a big table.
>
>Do you have a solution for me?
>
>Thank you
>Christine
Received on Mon Apr 23 2001 - 08:53:49 CDT