Re: select and update by row number
Date: 1996/12/09
Message-ID: <58flh1$5f9_at_newton.pacific.net.sg>#1/1
"Lun Wing San (Oracle)" <wslun_at_qrcsun.qrc.org> writes: > Steve Crowe wrote:
> > I am taking a CMIS course on databases. I am tring to update and query
> > my database by row number. I have a table with 12,410 records in it. I
> > need to query the 1st, the 6,205th, and the 12,410th rows. I tried
> > using RowNum in a where clause, but no dice. I also am thinking about
> > using RowID, but I am not sure how to go about this.
>
> select * from table_name where rownum=1 or rownum=6205 or rownum=12410;
>
> ---
> Name : Lun Wing San
> Title : Oracle Application Developer of Hong Kong Productivity Council
> Oracle Database Administrator and System Administrator of QRC
> Phone : (852)27885841
Hi there,
Rownum = number, will not work except for the very first row.
select * from t1 where rownum = 1 (this statement will work)
select * from t1 where rownum = 2 (this statement will return 0 rows)
You need to issue the following statement
select a.*
from ( select rownum x, c.* from order c) a
where a.x in (1,10,1000)
The above query will return 1st, 10th and 1000th row in that table.
I got the above query from this newsgroup.
Regards
N.Prabhakar Received on Mon Dec 09 1996 - 00:00:00 CET