--分页查询 create or replace package testpackage as type testcursor is ref cursor; end testpackage; /
--select * from (select rownum rn,a1.* from (select * from emp)a1 where rownum<=10) where rn>=6; create or replace procedure zk_pro7( zk_table in varchar2, zk_pagesize in number, zk_pagenow in number, zk_rownum out number, zk_rowcount out number, zk_cursor out testpackage.testcursor) is v_sql varchar2(1000); v_begin number:=(zk_pagenow-1)*zk_pagesize; v_end number:=zk_pagenow*zk_pagesize; begin v_sql:='select * from (select rownum rn,a1.* from (select * from '||zk_table||')a1 where rownum<='||v_end||') where rn>='||v_begin; open zk_cursor for v_sql; v_sql:='select count(*) from '||zk_table; execute immediate v_sql into zk_rownum; if mod(zk_rownum,zk_pagesize)=0 then zk_rowcount := zk_rownum/zk_pagesize; else zk_rowcount:=zk_rownum/zk_pagesize+1; end if; --关闭游标 close zk_cursor; end; /
[code="sql"]--分页查询create or replace package testpackage astype testcursor is ref cursor;end testpackage;/--select * from (select rownum rn,a1.* from (select * from emp)a1 where rownum=6;...