无法在 sql plus oracle 中创建过程和函数

Can't create procedure and function in sql plus oracle

无法在 pl/sql 中创建任何 procedure/function。总是在创建过程时出现编译错误。最后尝试使用以下代码

SQL>  CREATE OR REPLACE PROCEDURE REPORT(NAME VARCHAR2, VERSION VARCHAR2,
  2     STARTDATE DATE, ENDDATE DATE) AS 
  3   BEGIN 
  4   END REPORT;
  5   /

Warning: Procedure created with compilation errors.

SQL> show error procedure report;
Errors for PROCEDURE REPORT:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/2      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> <<
         close current delete fetch lock insert open rollback
         savepoint set sql execute commit forall merge pipe 

函数

CREATE OR REPLACE FUNCTION GETEMPSALARY (EMPNUMBER IN INTEGER) RETURN INTEGER
IS
DECLARE
EMPSALARY INTEGER;
BEGIN
SELECT SAL INTO EMPSALARY FROM EMP WHERE EMP.EMPNO = EMPNUMBER;
RETURN EMPSALARY;
END GETEMPSALARY;
/

有什么建议吗?

您的程序没有语句。至少放一个 NULL 语句让它编译:

CREATE OR REPLACE PROCEDURE REPORT(NAME VARCHAR2, VERSION VARCHAR2,
      STARTDATE DATE, ENDDATE DATE) AS 
BEGIN 
  NULL;
END REPORT;