问题描述
在db2中创建过程时出错。
I got error while creating procedure in db2.
错误是-预期的令牌可能包括:psm_semicolon .. SQLCODE = -104
Error is - Expected tokens may include: psm_semicolon.. SQLCODE=-104
帮助我... 。
CREATE PROCEDURE update_new()
LANGUAGE SQL
BEGIN
CREATE TABLE TEMP(METADATA_KEY varchar(40),NEW_METADATA_KEY varchar(40));
END;
推荐答案
在使用的任何工具中,更改语句终止符而不是分号,然后将该终止符放在 CREATE PROCEDURE
语句的末尾。
In whatever tool you're using, change the statement terminator to something other than semicolon and put that terminator at the end of the CREATE PROCEDURE
statement.
例如,如果使用命令行处理器,请将其保存到文件中(注意末尾的 @符号:
For example, if using the command line processor, save this to a file (note the "@" symbol at the end:
CREATE PROCEDURE update_new()
LANGUAGE SQL
BEGIN
CREATE TABLE TEMP(METADATA_KEY varchar(40),NEW_METADATA_KEY varchar(40));
END@
然后执行文件: db2- td @ -f myproc.sql
这样做的原因是分号始终用作中的终止符过程代码,因此您必须使用其他方法终止 CREATE PROCEDURE
语句。
The reason for doing this is that semicolons are always used as terminators within the procedure code, so you must use something else to terminate the CREATE PROCEDURE
statement.
这篇关于在db2中创建过程时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!