oracle10g分页

来源:百度知道 编辑:UC知道 时间:2024/06/30 16:42:43
给个oracle10g分页的例子。

if pagesize is null then
pagesize:=10;
end if;
if offsize is null then
offsize:=0;
end if;
if mod(totalrecords,pagesize)=0 then
totalpages:=trunc(totalrecords/pagesize);
else
totalpages:=trunc(totalrecords/pagesize)+1;
end if;
begrow:=offsize ;
endrow:=offsize+pagesize ;
sqlStrPage:='select * from ('||sqlstr||') where rowNo>='||to_char(begrow)||' and rowNo<='||to_char(endrow);
open returndates for sqlStrPage;