日期:2014-05-17  浏览次数:21020 次

package中procedure调用问题
create or replace package body pkg_insert is
  procedure proc_insert(user_info in users%Rowtype);
end pkg_insert;

create or replace package body pkg_insert is
  procedure proc_insert(user_info in users%Rowtype)
  as
  begin
  insert into users values(user_info.id,user_info.username,user_info.pass);
  exception when others then rollback;
  end;
  end pkg_insert; 
SQL> declare
  2 u users%rowtype;
  3 begin
  4 select 'ff','ff','ff' into u from dual;
  5 execute pkg_insert.proc_insert(u);
  6 exception when others then rollback;
  7 end;
  8 /
--以下错误信息
ORA-06550: 第 6 行, 第 9 列: 
PLS-00103: 出现符号 "PKG_INSERT"在需要下列之一时:
 := . ( @ % ;
  immediate
符号 ":=" 被替换为 "PKG_INSERT" 后继续。

/
请各位仁兄帮忙解决下,本人新手,自学中,谢谢!

------解决方案--------------------
execute pkg_insert.proc_insert(u);
 
这句改为:

 execute immediate pkg_insert.proc_insert(u);
------解决方案--------------------
execute pkg_insert.proc_insert(u);
 
应该改为:

 pkg_insert.proc_insert(u);

好像不需要execute,你试试
------解决方案--------------------
是的 调过程不需要execute,很长时间没写了 有点混淆了
------解决方案--------------------
oracle中调用过程应该都不要execute,我以前做的时候好像没碰到

比如过程中调用过程,直接写过程名称就可以了

execute immediate是在执行动态SQL时用的