Xref: alice comp.databases.oracle.server:53372
Path: alice!news-feed.fnsi.net!news.he.net!remarQ73!supernews.com!remarQ.com!remarQ69!news.remarQ.com!not-for-mail
From: "shailaja" <saila@irmac.com>
Newsgroups: comp.databases.oracle.server
Subject: Re: Best way to retrieve rows
Date: Tue, 15 Jun 1999 16:43:22 -0500
Organization: Posted via RemarQ Communities, Inc.
Lines: 51
Message-ID: <929482908.230.36@news.remarQ.com>
References: <7j3p8q$f6v@gap.cco.caltech.edu> <7j6jh1$ii3$1@autumn.news.rcn.net>
NNTP-Posting-Date: Tue, 15 Jun 1999 21:41:48 GMT
X-Trace: 929482908.230.36 URS.UUJEI0D25C690C qube-02.us-ca.remarq.com
X-Complaints-To: newsabuse@remarQ.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211


One more solution for the below query.

"select * from (select e.*,rownum p from emp e)
where p between 5 and 8"

shailaja.


Jerry Gitomer <jgitomer@hbsrx.com> wrote in message
news:7j6jh1$ii3$1@autumn.news.rcn.net...
> Hi,
>
>     You might try:
>
>             SELECT * FROM <table> WHERE rownum < 21
>             MINUS
>             SELECT * FROM <table> WHERE rownum < 11;
>
> regards
>
> Jerry Gitomer
> ----------------------------------------------------------------
>
> XU wrote in message <7j3p8q$f6v@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
>
>


