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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Which is the best way to select the Nth row ?

Re: Which is the best way to select the Nth row ?

From: Steve McDaniels <steve.mcdaniels_at_sierra.com>
Date: Wed, 20 Dec 2000 12:17:15 -0800
Message-ID: <91r43k$6p7$1@spiney.sierra.com>

List all rows in a table and show the list's row number for each record:

select rownum r, A.* from my_table A
/

Select the 55th row from a (arbitrary) list of records in table A:

select * from
  ( select rownum r, A.* from my_table A) where r = 55.
/

Select every 5th record from a list of records in table A:

select * from
  ( select rownum r, A.* from my_table A) where mod(r,5) = 0
/

"Francesco Marchioni" <Francesco.Marchioni_at_lastminutetour.com> wrote in message news:908aeg$qs0$1_at_marte.lastminutetour.com...
> Hello,
> I need a very simple task. A statement that SELECTS the Nth
> row from a table. Reading from manuals I cannot find a single
> statement to do it....as far as I understand you have to work with
> ROWID, issuing a few commands to achieve it, but I do hope there's a
 faster
> way
> to do it.....isn't there ?
> Thanks
> Francesco
>
>
>
Received on Wed Dec 20 2000 - 14:17:15 CST

Original text of this message

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