create or replace procedure p_GetList_AnyTable_s
(
in_select varchar2, /*select 后面传入sql语句*/
in_from varchar2, /*from 后面传入sql语句*/
in_where varchar2, /*where 后面传入sql语句*/
in_order_by varchar2, /*order by 后面传入sql语句*/
in_currentpage number /*当前页*/
/*out_maxbtotalpage out number*/ /*可显示最大页书*/
)
is
str varchar2(1000);
pagetotal number:=10; /*每页显示记录数*/
mina number;
maxb number;
begin
mina:=in_currentpage+(pagetotal*(in_currentpage-1));
maxb:=in_currentpage*pagetotal;
str:='select '||in_select||' from (select '||in_select||',rownum rn from '||in_from||' where ';if(in_where is not null)then
str:=str||in_where||' and ';
end if;
str:=str||'rownum<='||maxb||') where rn>='||mina;
if(in_order_by is not null)then
str:=str||' order by '||in_order_by;
end if;
execute immediate str;
end;
/
(
in_select varchar2, /*select 后面传入sql语句*/
in_from varchar2, /*from 后面传入sql语句*/
in_where varchar2, /*where 后面传入sql语句*/
in_order_by varchar2, /*order by 后面传入sql语句*/
in_currentpage number /*当前页*/
/*out_maxbtotalpage out number*/ /*可显示最大页书*/
)
is
str varchar2(1000);
pagetotal number:=10; /*每页显示记录数*/
mina number;
maxb number;
begin
mina:=in_currentpage+(pagetotal*(in_currentpage-1));
maxb:=in_currentpage*pagetotal;
str:='select '||in_select||' from (select '||in_select||',rownum rn from '||in_from||' where ';if(in_where is not null)then
str:=str||in_where||' and ';
end if;
str:=str||'rownum<='||maxb||') where rn>='||mina;
if(in_order_by is not null)then
str:=str||' order by '||in_order_by;
end if;
execute immediate str;
end;
/
解决方案 »
- oracle 大数据量表中的日期类型字段创建索引效率高吗?
- access 中链接表如何使用
- 急!触发器调用另一个数据库的过程的问题!在线等待。。。
- contains查询不出来结果
- 急急!使用oracle数据库,生成报表时CPU的IO占用率很高!
- desc t_name;显示这个表结构的时候能不能也把表的数据类型也显示出来啊?
- rehat linux+oracle9.2 修改参数后起不来,急!!!放100分,帮忙呀!!!
- 我是新手,请问数据库里所指的pageSize大小如什么2K,8K等,这个pageSize指的是什么?
- 多数据源间互操作问题
- 2台机器间orcal数据库如何连接
- 未找到预期from关键字?? case语句的问题
- oracle10g 安装问题
如何调用存储过程来显示AAA中的数据
begin
exec p_GetList_AnyTable_s(aa,AAA,where aa=1,aa,1);
end;提示:
ERROR 位于第 2 行:
ORA-06550: 第 2 行, 第 7 列:
PLS-00103: 出现符号 "P_GETLIST_ANYTABLE_S"在需要下列之一时:
:= . ( @ %
;
符号 ":=" 被替换为 "P_GETLIST_ANYTABLE_S" 后继续。
ORA-06550: 第 2 行, 第 35 列:
PLS-00103: 出现符号 "WHERE"在需要下列之一时:
( - + case mod new not
null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute
begin
str varchar2(1000);
str:='select * from AAA ';
execute immediate str;
end