警告:使用编译错误创建的Package Body

时间:2016-03-26 18:26:38

标签: oracle plsql

请检查我的包裹和程序。

我的包裹:

create or replace package transaction1 as
    procedure enter_transaction(acc number, kind varchar2, amount number);
    procedure apply_transaction;
end;
/

这是我的身体:

create or replace package body transaction1 as
    procedure enter_transaction(acc in number, kind in varchar2, amount in number) 
    is

    begin

    end;

    procedure apply_transaction
    is

    begin

    end;    
end;
/

警告是什么?为什么呢?

1 个答案:

答案 0 :(得分:7)

如果您看到警告:Errors: check compiler log

然后运行show errors命令,您将看到错误日志:

7/5            PLS-00103: Encountered the symbol "END" when expecting one of the following:

   ( begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   continue close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe purge

14/5           PLS-00103: Encountered the symbol "END" when expecting one of the following:

   ( begin case declare exit for goto if loop mod null pragma
   raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   continue close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe purge

如果你的包裹体甲骨文抱怨,因为BEGIN END阻止不包含任何命令。
在Oracle中,BEGIN-END块必须至少包含一个命令。可能为NULL,如果你不想运行任何东西(并且不要忘记在NULL命令后放置分号):

PROCEDURE ......
IS
BEGIN
  NULL;
END;