开发者

Oracle Package creation error

I created a package a开发者_如何学运维nd a package body as below:

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;

Now when I execute the package procedure with following statement:

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.

Can someone please suggest me what I have done wrong here?

Thank You.


It appears you're executing it inside a PL/SQL block, in which case you do not need the exec. Just do pkg_1.main('p1','p2',1); on its own.

Quite similar to part of this question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜