简体   繁体   English

更新记录时出现“ORA-00903:无效的表名”错误

[英]“ORA-00903: invalid table name” error while updating a record

I have this table called iowe . 我有一张名为iowe It has been created and exists in my database. 已经创建并存在在我的数据库。 This is how it looks like: 这是它的样子:

NAME           AMOUNT Serial Number
---------- ---------- -------------
Praveen         20500
Roshan           5000             2
Rohit            5000             3
Shashi           7500             4

When I try to update the Serial Number corresponding to the name Praveen, by inputting the command 当我尝试通过输入命令更新对应于Praveen名称的序列号

update table iowe
set "Serial Number" = 1 where amount = 20500

or 要么

update table iowe
set "Serial Number" = 1 where name = 'Praveen'

I get the following error: ORA-00903: invalid table name 我收到以下错误: ORA-00903: invalid table name

Other commands execute fine on this table. 其他命令在此表上执行正常。

You don't need the keyword table in an update statement : 您不需要更新语句中的关键字table

update iowe
set "Serial Number" = 1
where amount = 20500

As you have it, it's looking for a table called 'table ', while giving it the alias ' iowe '. 正如你所拥有的,它正在寻找一个名为 'table ' 'table ,同时给它别名 ' iowe '。

Not relevant to the question, but I would also really advise not giving objects mixed-case or non-standard names, since you have to quote them - as you are with "Serial Number" . 与问题无关,但我也建议不要给出混合大小写或非标准名称的对象,因为你必须引用它们 - 就像你使用"Serial Number" I have yet to see a case where the added complication and opportunities for confusion can be justified. 我还没有看到一个案例,其中增加的复杂性和混淆的机会是合理的。

Remove the word "table" from your update statement: 从更新语句中删除“table”一词:

update iowe
set "Serial Number" = 1 
where name = 'Praveen'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM