Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

oracle - PLS-00103: Encountered the symbol "CREATE"

What is the problem with this package as it is giving an error?

CREATE OR REPLACE PACKAGE PKG_SHOW_CUST_DETAILS 
AS
    PROCEDURE SHOW_CUST_DETAILS( myArg VARCHAR2);
END PKG_SHOW_CUST_DETAILS;

CREATE OR REPLACE PACKAGE BODY PKG_SHOW_CUST_DETAILS 
AS
    PROCEDURE SHOW_CUST_DETAILS(myArg VARCHAR2)
    IS
    BEGIN
        DBMS_OUTPUT.PUT_LINE(myArg);        
    END SHOW_CUST_DETAILS;

END PKG_SHOW_CUST_DETAILS;
/

On compilation of the above script, I am getting the following errors:

SQL> show errors
Errors for PACKAGE PKG_SHOW_CUST_DETAILS:

LINE/COL ERROR
-------- -----------------------------------------------------------------
6/1      PLS-00103: Encountered the symbol "CREATE"

The package is very simple and I am not able to compile it. I searched earlier answers on this error message and none of them did solve my problem. I am consistently getting this error for 2 more packages and I am stuck on this error message no matter what I do. I even tried to strip everything to the barest minimum as shown above, but the error message does not seem to go away. BTW I am executing this on command line SQL plus session after logging into my Oracle 11G database. YES- SET SERVEROUTPUT ON -- is executed and the error message has nothing to do with this command.

What am I missing?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

At line 5 there is a / missing.

There is a good answer on the differences between ; and / here.

Basically, when running a CREATE block via script, you need to use / to let SQLPlus know when the block ends, since a PL/SQL block can contain many instances of ;.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...