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: Best way to retrieve rows

Re: Best way to retrieve rows

From: wozi <wozi_at_dhc.net>
Date: Wed, 2 Jun 1999 17:31:53 -0700
Message-ID: <8EA7A53A0CD9DFD5.5B3E43EE1631FABF.E15AAE164874B7D9@lp.airnews.net>


ROWNUM returns the sequence number in which a row was retunred when first selected from a table. The first row has ROWNUM of 1, the second is 2, and so on. Logically, Oracle does not skip numbers when assigning ROWNUM to selected records. It starts with 1, 2, 3 and so on.

hope that helps.

XU wrote in message <7j3p8q$f6v_at_gap.cco.caltech.edu>...
>Hi, as we know that "select * from table_one where rownum <=10" will
>retrieve the first 10 rows of table_one, and "...where rownum <=20" will
>return the first 20 rows. But how about that I want to get the rows from
>11 to 20 of table_one? Is it possible to retrieve an arbitrary portion of
>a table using rownum (NOT just first 10, first 100, etc., rows)? One
>possible solution I came up with is using "minus". For example, for the
>11th to 20th rows of table_one:
>
>select * from table_one where rownum <=20
>minus
>select * from table_one where rownum <=10
>
>
>It seems to work but maybe there is a better solution? In general, this is
>a question of how to "page" through a large table - allow users to see the
>first 100 records, and then 101-200, 201-300, etc. Is rowid, sequence, ...
>going to be useful in this regard? Thanks.
>
>Robert XU
Received on Wed Jun 02 1999 - 19:31:53 CDT

Original text of this message

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