Oracle包创建错误

时间:2010-10-26 20:33:16

标签: oracle oracle10g oracle11g

我创建了一个包和一个包体,如下所示:

Create or replace Package pkg_1
as
procedure main(param1 varchar2, param2 varchar2, param3 int);
procedure one(param1 varchar2, param2 varchar2);
procedure two(param1 varchar2, param2 varchar2);
end pkg_1;
/

create or replace package body pkg_1
as
procedure main (param1 varchar2, param2 varchar2, param3 int)
is
v_sql_script varchar2(1000);
begin
case param3
when 1 then
v_sql_script := 'begin exec pkg_1.one(:param1,:param2); end;';
execute immediate v_sql_script using param1, param2;
end case;
end;

现在,当我使用以下语句执行包过程时:

exec pkg_1.main('p1','p2',1);

I got the following error:

ORA-06550: line 1, column 12:
PLS-00103: Encountered the symbol "PKG_1" when expecting one of the following:

   := . ( @ % ;
The symbol ":=" was substituted for "PKG_1" to continue.

有人可以告诉我这里我做错了吗?

谢谢。

1 个答案:

答案 0 :(得分:5)

看来你正在PL / SQL块中执行它,在这种情况下你不需要exec。只需自己做pkg_1.main('p1','p2',1);

this question的一部分非常相似。