PL/SQL无参数过程的创建

根据编程语言的惯性思维一般会这样写

CREATE OR REPLACE PROCEDURE PRO_NAME()

但很可惜编译不通过

PLS-00103: Encountered the symbol ")" when expecting one of the following:

<an identifier> <a double-quoted delimited-identifier>

current delete exists prior 

将其改成

CREATE OR REPLACE PROCEDURE PRO_NAME

去掉括号就OK了

另外在PL/SQL中语句块之间如果没有代码的话也是会报错

比如

CREATE OR REPLACE PROCEDURE PRO_NAME
IS
BEGIN
END PRO_NAME;

在BEGIN 和END之间没有代码,通过语句

SELECT * FROM USER_ERRORS WHERE NAME='PRO_NAME';

可以查看到完整的错误信息如下

NAME                           TYPE           SEQUENCE       LINE   POSITION TEXT                                                                             ATTRIBUTE MESSAGE_NUMBER
------------------------------ ------------ ---------- ---------- ---------- -------------------------------------------------------------------------------- --------- --------------
PRO_NAME                       PROCEDURE             1          4          1 PLS-00103: Encountered the symbol "END" when expecting one of the following:     ERROR                103
                                                                                                                                                                        
                                                                                ( 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                                
 

 

另外在LOOP 和END LOOP之间也不能出现空代码。。。。这些书上都没讲到略蛋疼。

posted @ 2013-08-11 18:30  ZJF_CFC9  阅读(759)  评论(1编辑  收藏  举报