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,它曾经有效,但今天却给了我同样的信息。
解决方案
添加分号where id=:id
后
其他提示
你这里有很多问题:
缺少分号(如 MJB 所见)
:ID
引用一个入站变量,所以你的本地声明(DECLARE ID NUMBER;
) 未被使用。您使用的变量名称(显然)与表中的列名称相同。如果您尝试使用本地
ID
变量,除非您使用块标签,否则查询仍然不会使用它。
也就是说,看起来您无论如何都将 ID 作为绑定变量发送,因此更有可能的是您应该从块中删除声明。
在除了前面的,你必须防止等于操作,之间的空间:,并且该值 像这样:
SQL> BEGIN
2 IF x > y THEN high := x; END IF; -- correct
3 IF x > y THEN high := x; ENDIF; -- incorrect
4 END;
5 /
END;
ERROR at line 4:
ORA-06550: line 4, column 4:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
if
访问网站阅读更多.... https://docs.oracle.com/cd/B28359_01 /appdev.111/b28370/fundamentals.htm#LNPLS002
不隶属于 StackOverflow