oracle的多表分页存储过程调用出错,今天写了个oracle的多表分页存储过程,但是在调用时会出错,
--创建包规范
create or replace package package_page as
--author:liubg
--createTime:2008-08-18 10:30
--purpose:分页返回数据集
type cursor_page is ref cursor;
Procedure proc_page(
p_curpage Number, --当前页
p_pagesize Number, --页面大小
--p_sql varchar2,
p_cursor out cursor_page); --结果集
end package_page;
--创建包主休
Create Or Replace Package Body package_page
Is
Procedure proc_page(
p_curpage Number,
p_pagesize Number,
--p_sql varchar2,
p_cursor out cursor_page
)
is
v_count_sql varchar2(2000);
v_select_sql varchar2(2000);
begin
v_select_sql:='select * from(select kc.key_class_name,
substr(km.sm_content, 0, 19) || "...." ct,
substr(zu.usernickname, 0,5) shortname,
km.total_count,
to_char(km.pass_time, "YY-MM-DD") pt,
zu.usernickname,
km.key_message_id,
row_number() over ( order by km.pass_time desc ) rn
from key_class kc,zk_product z
left join key_message_new km on z.prosourceid = km.key_message_id
left join zk_product_type zt on zt.protypeid = z.protypeid