pl / sql脚本在运行简单过程时遇到问题

时间:2012-02-17 15:00:14

标签: oracle stored-procedures plsql oracle-sqldeveloper

我有一个名为logger(message)的存储过程,其中message的类型为varchar2。

当我执行

 exec logger('hello'); 

它表示匿名块已完成,此过程的作用只是在另一个表中插入记录。

但是,当我用它作为脚本的一部分时说:

  Begin

    select count(*) into countCol from USER_TAB_COLUMNS where TABLE_NAME = 'EVAPP_INTERFACE_APPENTITY' and COLUMN_NAME = 'ORIGPTI_NUM' and DATA_SCALE is null; 
  IF    (countCol <> 0) then   

 execute immediate 'alter table EVAPP_INTERFACE_APPENTITY add ORIGPTI_NUM_TMP NUMBER(14,2)' ; 

 execute immediate 'update EVAPP_INTERFACE_APPENTITY set ORIGPTI_NUM_TMP = ORIGPTI_NUM' ; 

 execute immediate 'alter table EVAPP_INTERFACE_APPENTITY drop column ORIGPTI_NUM' ; 

 execute immediate 'alter table EVAPP_INTERFACE_APPENTITY rename column ORIGPTI_NUM_TMP to ORIGPTI_NUM' ; 


 DBMS_OUTPUT.put_line('This column EVAPP_INTERFACE_APPENTITY.ORIGPTI_NUM has been modified to the required precision'); 
   END IF; 

  execute logger(' first insert');

我收到此错误说:

  Error report:
  ORA-06550: line 27, column 10:
  PLS-00103: Encountered the symbol "LOGGER" when expecting one of the following:

   := . ( @ % ; immediate
   The symbol ":=" was substituted for "LOGGER" to continue.

我尝试立即执行并只插入logger(),但没有任何作用。

当我尝试在脚本中搜索执行存储过程时,我对谷歌没有多少帮助。我该如何调用此程序?

1 个答案:

答案 0 :(得分:5)

从该行删除“执行”一词:

logger(' first insert');