oracle PLS-00103:遇到符号“CREATE”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20334067/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PLS-00103: Encountered the symbol "CREATE"
提问by Surya
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.
该包非常简单,我无法编译它。我搜索了有关此错误消息的早期答案,但没有一个确实解决了我的问题。对于另外 2 个软件包,我一直收到此错误,无论我做什么,我都被困在此错误消息上。我什至尝试将所有内容剥离到最低限度,如上所示,但错误消息似乎并没有消失。顺便说一句,登录到我的 Oracle 11G 数据库后,我正在命令行 SQL plus 会话上执行此操作。YES- SET SERVEROUTPUT ON -- 已执行,错误消息与此命令无关。
What am I missing?
我错过了什么?
回答by Drumbeg
At line 5 there is a /
missing.
在第 5 行有一个/
缺失。
There is a good answer on the differences between ;
and /
here.
关于;
和/
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 ;
.
基本上,当CREATE
通过脚本运行块时,您需要使用/
来让 SQLPlus 知道块何时结束,因为 PL/SQL 块可以包含;
.
回答by Nikhil
Run package declaration and body separately.
分别运行包声明和正文。