PLS-00103:遇到符号“文件结束”在简单的更新块中

发布于 2024-09-05 18:53:18 字数 727 浏览 10 评论 0原文

以下 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

带上头具痛哭 2024-09-12 18:53:18

where id=:id 后添加分号

Add a semi-colon after where id=:id

浅笑依然 2024-09-12 18:53:18

这里有很多问题:

  1. 缺少分号(如 MJB 所见)

  2. :ID 指的是 in-绑定变量,因此您的本地声明 (DECLARE ID NUMBER;) 未被使用。

  3. 您使用的变量名称(显然)与表中的列名称相同。如果您尝试使用本地 ID 变量,除非您使用块标签,否则查询仍然不会使用它。

也就是说,看起来您无论如何都将 ID 作为绑定变量发送,因此更有可能的是您应该从块中删除声明。

You have a number of problems here:

  1. Missing semi-colon (as MJB saw)

  2. :ID refers to an in-bound variable, so your local declaration (DECLARE ID NUMBER;) is not being used.

  3. 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.

帝王念 2024-09-12 18:53:18

除了前面的之外,您还必须防止相等运算、:和值之间存在空格
像这样:

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

In addition to the previous you have to prevent spaces between equal operation ,:,and the value
like this:

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

visit the website to read more....
https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/fundamentals.htm#LNPLS002

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文