If you are already on release V5R4 or higher, you may try the following:

With x as (Select Fld1, Fld2, Fld3, ... FldN,
Row_Number() Over(Order By Sort1, Sort2 ... SortN) as
From ...
Where ...
Order By Sort1, Sort2, ... SortN)
Select x.*
From x
Where RowNbr Between 10 and 20
Order By RowNbr

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Srinivas Boggula
Gesendet: Wednesday, July 23, 2008 14:04
An: Midrange Systems Technical Discussion
Betreff: SQL Query : Fetch Next 10 rows

Hi All,

Each time when I run my query I need to fetch next 10 rows from a Physical

Example: First Time 10 rows (i.e. 1 to 10 rows)
Second time another 10 rows (i.e. 11 records to 20 records)
Third Time another 10 rows (i.e 21 records to 29
records) and so on....

I have tried with below query, but I'm confused how to increment RRN value

SELECT * FROM faplo WHERE RRN(faplo) >= 10 and RRN(faplo) <= 20

Thanks in Advance

iGATE is Ranked No. 3 in DQ-IDC best IT employer survey and Ranked No.6
by Business Today-Mercer Human Resource Consulting-TNS in a cross industry
survey of Best Companies to work for in India
Information transmitted by this EMAIL is proprietary to iGATE Group of
Companies and is intended for use only by the individual
or entity to whom it is addressed and may contain information that is
privileged, confidential, or exempt from disclosure under
applicable law. If you are not the intended recipient of this EMAIL
immediately notify the sender at iGATE or mailadmin@xxxxxxxxx
and delete this EMAIL including any attachments

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page