Reputation: 11
I'm trying to do the pagination for the as400 table which is of version 6 and release 1
I'm using this query:
select * from AJSTYLES91.CLIENT
ORDER BY CNUM
LIMIT 2 [OFFSET 2];
but is not working so can any one suggest me the proper query to use please!!!
Upvotes: 1
Views: 201
Reputation: 2473
I think declare global temporary table
works in v6r1
. You can select all of your rows into a temporary table.
declare global temporary table orders as (
/* open orders */
select a.orhordnum ordnum, a.orhshpnam shipname
from dwhpf30c a
where a.orhcmp = 'N'
order by a.orhshpnam
) with data with replace
then use rrn
on that resulting table to calculate the page number and select on that page.
select a.ordnum, a.shipname, rrn(a),
decimal( (rrn(a) -1) / 30,5,0) + 1 pageNum
from qtemp/orders a
where decimal( (rrn(a) -1) / 30,5,0) + 1 = 5
Upvotes: 1