Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Newbie : Getting only limited number of rows
Hi,
Your initial problem is, that you DON'T want to limit the number of rows
processed, but the number of rows returned. Rownum limits the number of
rows processed, that's why it does't work the way you want.
The answer to your question is, that SQL*PLUS won't help you there. Noone will, unless you turn to PL/SQL or embedded SQL. In short, what you do is to execute a cursor, and only fetch the number of times you desire. In PL/SQL that might look like:
DECLARE
CURSOR C1 IS
SELECT SALESPERSON, SUM(SALES) SALES
FROM SALES GROUP BY SALESPERSON
avaneesh.arora wrote:
>
> HI,
>
> I have the following problem :
>
> I want to select a limited number of rows from a table sorted on a
> particular set of columns. How do I structure my query to get, say Next N
> rows(50/100) based on the specified sort order. Limiting it by ROWNUM limits
> the row count and does not work as desired.
>
> Please help.
> Thanks,
> Avaneesh
Received on Fri Jun 12 1998 - 00:00:00 CDT
![]() |
![]() |