PLS-00103:遇到符号“文件结束”在简单的更新块中
以下 Oracle 语句:
DECLARE ID NUMBER;
BEGIN
UPDATE myusername.terrainMap
SET playerID = :playerID,tileLayout = :tileLayout
WHERE ID = :ID
END;
给我以下错误:
ORA-06550: line 6, column 15:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 3, column 19:
PL/SQL: SQL Statement ignored
ORA-06550: line 6, column 18:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
( begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted>
我几乎不知所措。这似乎是一个相当简单的陈述。如果有帮助的话,我有一个类似的语句,它执行了一个 INSERT,它曾经有效,但今天却给了我同样的信息。
The following Oracle statement:
DECLARE ID NUMBER;
BEGIN
UPDATE myusername.terrainMap
SET playerID = :playerID,tileLayout = :tileLayout
WHERE ID = :ID
END;
Gives me the following error:
ORA-06550: line 6, column 15:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 3, column 19:
PL/SQL: SQL Statement ignored
ORA-06550: line 6, column 18:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
( begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted>
I am pretty much at a loss. This appears to be a rather simple statement. If it helps any, I had a similar statement that performed an INSERT which used to work, but today has been giving me the same message.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在
where id=:id
后添加分号Add a semi-colon after
where id=:id
这里有很多问题:
缺少分号(如 MJB 所见)
:ID
指的是 in-绑定变量,因此您的本地声明 (DECLARE ID NUMBER;
) 未被使用。您使用的变量名称(显然)与表中的列名称相同。如果您尝试使用本地
ID
变量,除非您使用块标签,否则查询仍然不会使用它。也就是说,看起来您无论如何都将 ID 作为绑定变量发送,因此更有可能的是您应该从块中删除声明。
You have a number of problems here:
Missing semi-colon (as MJB saw)
:ID
refers to an in-bound variable, so your local declaration (DECLARE ID NUMBER;
) is not being used.You're using a variable name which (apparently) is the same name as a colum in your table. If you try to use your local
ID
variable, the query will still not use it unless you use a block label.That said, it looks like you're sending ID in as a bind variable anyway, so it's more likely that you should just remove the declaration from the block.
除了前面的之外,您还必须防止相等运算、:和值之间存在空格
像这样:
访问网站了解更多......
https://docs.oracle.com/cd/B28359_01 /appdev.111/b28370/fundamentals.htm#LNPLS002
In addition to the previous you have to prevent spaces between equal operation ,:,and the value
like this:
visit the website to read more....
https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/fundamentals.htm#LNPLS002