PLSQL无意义(?)错误PLS-00103在包和包体中

时间:2018-04-12 23:31:20

标签: database oracle plsql pls-00103

我得到了我认为是一个程序无意义的错误。

CREATE OR REPLACE PACKAGE reg AS
    TYPE ref_cursor IS ref cursor;
    ...
    FUNCTION show_enrollments RETURN ref_cursor;
    PROCEDURE return_prereqs
        (param_dept_code IN prerequisites.dept_code%type,
        param_course_no IN prerequisites.course_no%type);
>   PROCEDURE enroll
>       (param_sid IN enrollments.sid%type,
>       param_classid IN enrollments.classid%type,
>       err_msg OUT varchar(76));
    PROCEDURE delete_student
        (param_sid IN enrollments.sid%type);
    ...
END;
/
show errors

我收到的错误

 LINE/COL ERROR
 -------- -------
 31/23    PLS-00103: Encountered the symbol "(" when expecting one of the
          following:
          := . ) , @ % default character
          The symbol ":=" was substituted for "(" to continue.

我得到的包体错误

 LINE/COL ERROR
 -------- -------
 328/23   PLS-00103: Encountered the symbol "(" when expecting one of the
          following:
          := . ) , @ % default character
          The symbol ":=" was substituted for "(" to continue.

这是程序包正文中的程序

PROCEDURE enroll
    (param_sid IN enrollments.sid%type,
    param_classid IN enrollments.classid%type,
    err_msg OUT varchar(76)) 
IS...

我在这里做些蠢事吗?我看不出有什么不对,而且非常令人沮丧。

2 个答案:

答案 0 :(得分:2)

我很确定它是err_msg OUT varchar(76),因为Oracle中没有VARCHAR数据类型,只有VARCHAR2

尝试:

PROCEDURE enroll
    (param_sid IN enrollments.sid%type,
    param_classid IN enrollments.classid%type,
    err_msg OUT varchar2(76)) 
IS...

有关详细信息,请参阅SQL Data Types in the PL/SQL Language Reference

答案 1 :(得分:1)

您好请删除程序中的大小,如下所示:

  PROCEDURE enroll
       (param_sid IN enrollments.sid%type,
       param_classid IN enrollments.classid%type,
       err_msg OUT varchar2);

这里我也有更名,但你可以保留你的名字

尺寸:

enter image description here

删除尺寸后:

enter image description here