pl/sql 脚本在运行简单过程时出现问题
我有一个名为 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() ,但没有任何效果。
当我尝试在脚本中搜索执行存储过程时,我没有得到谷歌的太多帮助。我如何调用这个过程?
I have a stored procedure called logger(message), where message is of type varchar2.
When I execute just
exec logger('hello');
it says anonymous block completed, and what this procedure does is just insert a record in another table.
However, when I use it as a part of script say:
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');
I get this error saying :
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.
I tried execute immediate and just inserting logger() , but nothing works.
And I haven't had much help with google when I tried searching for execute stored procedure in script. How do I call this procedure?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从该行中删除“执行”一词:
Remove the word "execute" from that line: