2016-03-26 55 views
0

請檢查我的包裝和程序。警告:使用編譯錯誤創建的包裝體

我的包:

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; 
/

什麼警告?爲什麼?

回答

6

如果你看到一個警告: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;