java 读取4.5T文件的数据之后可以实现分页吗?可以的话如何实现?
1个回答
展开全部
数据库分页,可用存储过程呀~
create or replace package fenyepackage as
type fenyecursor is ref cursor;
end fenyepackage;
--------
表--条件--排序--当前页--一页几条--总页数--总条数六个条件!
create or replace procedure fenye(
tablename varchar2,
condition varchar2,
orderby varchar2,
pageno number,
pagerow number,
totalpage out number,
totalrow out number,
scursor out fenyepackage.fenyecursor
)
is
v_sql1 varchar2(500);
v_sql2 varchar2(500);
begin
v_sql1:='select * from '||tablename;
v_sql2:='select count(*) from '||tablename;
if
condition is not null then
v_sql1:=v_sql1 ||' where '||condition;
v_sql2:=v_sql2 ||' where '||condition;
end if;
if
orderby is not null then
v_sql1:=v_sql1 ||' order by '||orderby;
end if;
v_sql1:='select tt.* from ( select v.*,rownum as r from ( '||v_sql1||') v ) tt where tt.r between '||pagerow||'*('||pageno||'-1)+1 and '||pageno||'*'||pagerow ;
open scursor for v_sql1;
execute immediate v_sql2 into totalrow;
if mod(totalrow,pagerow)=0 then
totalpage:=totalrow/pagerow;
else
totalpage:=totalrow/pagerow+1;
end if;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询