Re: SELECTing N rows

From: <scott.donaldson_at_virgin.net>
Date: Thu, 13 Aug 1998 00:10:46 +0100
Message-ID: <35D220F6.720A_at_virgin.net>


Lan H. Tran wrote:
>
> could someone help me write a query that will
> 1. return rows 1 - 100 from a table,
> 2. return rows 101 - 200 from a table,
> 3. etc..
>
> please reply to my e-mail as well as this group. thanks in advance.
>
> Lan
>
> ---------------------------------------------------------------
>
> Name: vcard.vcf
> Part 1.1.2 Type: text/x-vcard
> Encoding: 7bit
> Description: Card for Lan Tran
>
> Name: smime.p7s
> Part 1.2 Type: application/x-pkcs7-signature
> Encoding: base64
> Description: S/MIME Cryptographic Signature

In PL/SQL this is of course easy (using a cursor and checking cursor%ROWCOUNT).

In SQL*PLUS you cannot do this easily in a single query, as you are trying to perform an aggregate instruction based on a non-group function. If you have knowledge of the data in advance, you could select within range values (even using ROWIDTOCHAR to select rows within specific rowid boundaries, where the boundaries are known in advance). If the range values are not known, you have a problem. You do know the first and last of these boundaries (using the MIN and MAX functions) but the problem is retaining memory of the previous operation for the next 100 step increment between these boundaries.

More than you wanted! (Use PL/SQL)

Scott Received on Thu Aug 13 1998 - 01:10:46 CEST

Original text of this message