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: Display only part of resultset

Re: Display only part of resultset

From: Rainer Klomps <Rainer.Klomps_at_t-online.de>
Date: Fri, 19 Dec 2003 17:36:29 +0100
Message-ID: <3FE3290D.2040102@t-online.de>


Pavel,

would something like

select empno from ( select empno from emp where rownum <= 10 order by rownum desc)
where rownum <= 5 order by -rownum;

help?
Be aware that this will need a full table scan.

Pavel Vetesnik schrieb:
> Greetings,
>
> I have question which was probably discussed million times before, but I was
> not able to find an answer.
> I have little application written in PL/SQL that allows user to search
> database. The result can be several hundreds (or thousands) records.
> I want to show only limited amount of them (let's say 20 records) per page
> and let user to skip to other pages with results. What is the preffered way
> to do this?
>
> (a) The easiest way is to create cursor and within loop fetch & skip to
> particular "page". But I am not sure that fetching several thousands of
> records to find 150th page is good idea.
>
> (b) The other way is using "rownum" column. I can take only first 20 rows
> using such query:
> ------------------------------------------
> SELECT nazev, psh1
> FROM (SELECT nazev, psh1 FROM vw_stk WHERE id_psh1=10 ORDER BY nazev)
> WHERE ROWNUM<=20;
> ------------------------------------------
> The problem is, that I can't take other records (only first ones) using this
> technique (condition WHERE ROWNUM>20 AND ROWNUM<=40 can't work, because
> ROWNUM is just pseudocolumn created dynamically).
>
> Please can you tell me, what is the preffered way to do this? Oracle Portal
> is doing it somehow (ie.
> http://newalex.stk.cz:7777/pls/portal30/!JIRIB.RPT_ISSN_VYBER.show).
>
> Thank you very much in advance,
> Pavel
>
>
Received on Fri Dec 19 2003 - 10:36:29 CST

Original text of this message

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