搜索墙首页  编程技术  java  asp  ajax  php  c/c#/c++  数据库  oracle  mysql  db2  操作系统  windows  linux  股吧
首页 > 编程 > 数据库 > oracle
 1         
1楼  sxlcom 2007-04-29 11:29:46

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;
/
2楼  sxlcom 2007-04-29 11:42:13

如果我有表AAA(aa   number,bb   varchar2(500))
如何调用存储过程来显示AAA中的数据
3楼  njuzgj 2007-04-29 11:53:33

procedure   p_GetList_AnyTable_s(aa,AAA,参数,参数,参数)
4楼  sxlcom 2007-04-29 12:18:36

我用以下语句不行呀!
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
5楼  sxlcom 2007-04-29 12:46:09

我用以下语句出不行为什么??
begin
str   varchar2(1000);  
str:= 'select   *   from   AAA   ';
execute   immediate   str;
end
 1         
您的发言将按有关规定都会存档,您须为所发表后果负责,请您遵纪守法并注意语言文明。
标题:如何调用
热门关注
标题回复点击
Oracle 10g (ASM):Sample Implementation0816
Oracle 正版用户授权0781
动态性能视图(Dynamic perfermance view V$)0770
EM 无法启动&&重新完全配置EM0637
OracleDBConsole 服务因 2 (0x2) 服务性错误而停止。请问一下如何解决!2466
小布老师Oracle 9i DBA Fundamentals II0408
ORA-1652: unable to extend temp segment诊断以及解决0391
Oracle Linux 和 iSCSI 上构建您自己的 Oracle RAC集群10381
locate pl/sql bottleneck0346
缓冲处理器 buffer handle0341
搜索墙@2009 www.pkwall.com all rights reserved QQ:276471788 [京ICP备09111534号]
声明:本站部分数据来源于网络,仅供参考,如有版权问题,请联系我们,我们将及时删除!转载本站请注明来源