select x.*,
	ceil(rnum / :lcnt) as pgno,
	0 chkval,
	max(rnum) over() as maxnum
from (
	select
		ROW_NUMBER() OVER (ORDER BY a.vlin) as rnum,
		a.vlin,
		a.jan,
		a.gdcls9nm,
		a.gdjnm,
		a.gdjstnd,
		a.jpno,
		a.tpno,
		a.fcst,
		a.icst,
		a.amt2,
		a.amt,
		a.jmcatnm,
		to_char(a.min_idat,'yyyy/mm/dd  hh24:mi:ss') as idat,
		to_char(a.max_udat,'yyyy/mm/dd  hh24:mi:ss') as udat,
		a.tcls,
		a.tclsnm
	from af226v02 a
	where a.ktktcd=:ktktcd
		and a.cucd=:cucd
		and a.cuscd=:cuscd
		and a.vseq=:vseq
		and a.viseq=:viseq
	) x
	order by x.rnum
