select x.*,
	ceil(rnum / :lcnt) as pgno,
	max(rnum) over() as maxnum
from (
	select
		ROW_NUMBER() OVER (ORDER BY cucd) as rnum,
		a.txt_cucd,
		a.txt_cunm,
		a.asum,
		to_char(a.cdat,'yyyy/mm/dd') cdat,
		a.kbn,
		a.cucd,
		a.cuscd,
		a.sbat
	from af264v01 a
	where a.ktktcd = :ktktcd
	  and a.cudt = :cudt
) x
order by x.rnum
