调用这样的存储过程,为什么说我得参数不对?请大家多多指教!
存储过程如下:
--包头
create or replace package PageTest is
TYPE T_CURSOR IS REF CURSOR;
Procedure Per_QuickPage
(
p_PageSize in number, --每页记录数
p_PageNo in number, --当前页码,从 1 开始
p_SqlSelect in varchar2, --查询语句,含排序部分
p_SqlCount in varchar2, --获取记录总数的查询语句
p_OutRecordCount out number,--返回总记录数
p_OutCursor out T_CURSOR
);
end PageTest;
--包体
create or replace package body PageTest
is
procedure Per_QuickPage
(
p_PageSize in number, --每页记录数
p_PageNo in number, --当前页码,从 1 开始
p_SqlSelect in varchar2, --查询语句,含排序部分
p_SqlCount in varchar2, --获取记录总数的查询语句
p_OutRecordCount out number,--返回总记录数
p_OutCursor out T_CURSOR
)
as
v_sql varchar2(3000);
v_count int;
v_heiRownum int;
v_lowRownum int;
begin
----取记录总数
execute immediate p_SqlCount into v_count;
p_OutRecordCount := v_count;
----执行分页查询
v_heiRownum := p_PageNo * p_PageSize;
v_lowRownum := v_heiRownum - p_PageSize + 1;
v_sql := 'SELECT *
FROM (
SELECT A.*, rownum rn
FROM ( '|| p_SqlSelect || ') A
WHERE rownum <= '|| to_char(v_heiRownum) || '
) B