Note the select * isn't recommended for production use on a large table.

Here's a slightly modified statement that returns records 1,000,000 - 1,000,010

with tbl as (
select *
from (select *
from ( select akey
from addrinp
order by akey
fetch first 1000000 rows only
) t1
order by akey desc
fetch first 10 rows only
) t2
)
select * from addrinp A, tbl
where tbl.akey = a.akey

Not quite sub-second...but pretty close, and if your user has hit the page key for the 100,000 time
they may not be smart enough to notice anyway ;)


Charles Wilt
--
Software Engineer
CINTAS Corporation - IT 92B
513.701.1307

wiltc@xxxxxxxxxx


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Wilt, Charles
Sent: Tuesday, August 12, 2008 5:01 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Returning Record Sets from SQLRPGLE Web Services

This might help:

http://systeminetwork.com/article/use-sql-paging-cgi-programs


basically:


select *
from (select *
from ( select *
from svcvhdp
order by svcnum
fetch first (:rowsPerPage * :pageNumber) rows only
) t1
order by svcnum desc
fetch first :PageNumber rows only
) t2
order by svcnum

Make sure you have the needed indexes.

Charles Wilt
--
Software Engineer
CINTAS Corporation - IT 92B
513.701.1307
wiltc@xxxxxxxxxx


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx]
On Behalf Of Coyle, Stephen F.
Sent: Tuesday, August 12, 2008 4:18 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: Returning Record Sets from SQLRPGLE Web Services

Hi All,
I have a web service that calls a SQLRPGLE program and returns a
maximum of 1000 records. If a statement selects over 1000 records, and
multiple calls to the service are needed, how will the service know
where the current cursor should be?
The .net consultant who is writing the front end wants to pass a
page number, so for records 1000 through 2000 he would request page 2.
I think this would be possible using FETCH RELATIVE but I think this
would require that the cursor cannot move between calls and I cannot
guarantee that. Correct?
Just wondering how others might be handling this paging
situation in a web service.

Thanks for all suggestions and ideas...

Currently I'm using "Fetch C1 for :MaxElem Rows Into :OutDATA ; ".

- Steve
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




This e-mail transmission contains information that is intended to be
confidential and privileged. If you receive this e-mail and you are not a
named addressee you are hereby notified that you are not authorized to
read, print, retain, copy or disseminate this communication without the
consent of the sender and that doing so is prohibited and may be unlawful.
Please reply to the message immediately by informing the sender that the
message was misdirected. After replying, please delete and otherwise
erase it and any attachments from your computer system. Your assistance
in correcting this error is appreciated.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




This e-mail transmission contains information that is intended to be confidential and privileged. If you receive this e-mail and you are not a named addressee you are hereby notified that you are not authorized to read, print, retain, copy or disseminate this communication without the consent of the sender and that doing so is prohibited and may be unlawful. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please delete and otherwise erase it and any attachments from your computer system. Your assistance in correcting this error is appreciated.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].