select x.*,
	ceil(rnum / :lcnt) as pgno,
	0 chkval,
	max(rnum) over() as maxnum
from (
	select
		ROW_NUMBER() OVER (ORDER BY a.cucd) as rnum,
		a.cucd mcd,
		a.cunm mnm,
		a.bal,
		a.sal,
		a.tax,
		a.sal + a.tax amt,
		a.pay,
		a.bsal,
		a.amt1 amt8,
		a.amt2 amt9,
		a.amt3 amt10,
		a.amt4 amt11,
		a.amt5 amt12,
		a.amt7 amt13
	from af483v02 a
	where a.wseq=:wseq
) x
order by x.rnum
