Oracle SQL Developer: PL/SQL: ORA-00903: 无效的表名

发布于 2024-11-05 00:30:48 字数 736 浏览 0 评论 0原文

我收到此错误:

Error starting at line 2 in command:
BEGIN
  DELETE * FROM book_copies;
  DELETE * FROM books;
  /* more code here */
END;
Error report:
ORA-06550: line 2, column 10:
PL/SQL: ORA-00903: invalid table name
ORA-06550: line 2, column 3:
PL/SQL: SQL Statement ignored
ORA-06550: line 3, column 10:
PL/SQL: ORA-00903: invalid table name
ORA-06550: line 3, column 3:
PL/SQL: SQL Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

这很荒谬,因为两个表都存在于我的数据库中。我可以这样做:

SELECT * FROM books;

或者:

SELECT * FROM book_copies;

两者都有效。

为什么 Oracle SQL Developer 说“无效的表名”?

I am getting this error:

Error starting at line 2 in command:
BEGIN
  DELETE * FROM book_copies;
  DELETE * FROM books;
  /* more code here */
END;
Error report:
ORA-06550: line 2, column 10:
PL/SQL: ORA-00903: invalid table name
ORA-06550: line 2, column 3:
PL/SQL: SQL Statement ignored
ORA-06550: line 3, column 10:
PL/SQL: ORA-00903: invalid table name
ORA-06550: line 3, column 3:
PL/SQL: SQL Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

Which is ridiculous as both tables exist in my database. I can do:

SELECT * FROM books;

Or:

SELECT * FROM book_copies;

And both of them work.

Why does Oracle SQL Developer says "invalid table name"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

清风不识月 2024-11-12 00:30:48

DELETE 语句中,至少在 Oracle 中,您不会列出列,并且 FROM 是可选的。因此,当您DELETE * ...时,它会尝试将星号解析为表名。请注意,如果对列进行计数,第 10 列就是星号,这是报告无效表名的位置。

编写DELETE FROM book_copiesDELETE book_copies

In a DELETE statement, at least in Oracle, you don't list columns, and FROM is optional. So when you DELETE * ..., it is trying to parse the asterisk as the table name. Note that if you count the columns, column 10 is the asterisk, which is where the invalid table name is being reported.

Write DELETE FROM book_copies or DELETE book_copies.

a√萤火虫的光℡ 2024-11-12 00:30:48

但你应该

DELETE FROM book_copies;

(没有 * 借自 Access)

But you should

DELETE FROM book_copies;

(no * borrowed from Access)

神回复 2024-11-12 00:30:48

出现错误

drop 和 alter

相同的错误:表名无效,

但表存在,请告诉解决方案。

追问:

ALTER TABLE [EXCLUDE_BC]
DROP COLUMN [STATUS_BY_SITE] VARCHAR2(60 BYTE), [ALT_STATUS_BY_SITE] VARCHAR2(60 BYTE), [STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE),[ALT_STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE);

ALTER TABLE [EXCLUDE_BC]
ADD [STATUS_BY_SITE] VARCHAR2(60 BYTE), [ALT_STATUS_BY_SITE] VARCHAR2(60 BYTE), [STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE),[ALT_STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE);

谢谢。
问候。
什韦塔

Getting error for

drop and alter

same error : invalid table name

but table is there, please tell the solution.

Query:

ALTER TABLE [EXCLUDE_BC]
DROP COLUMN [STATUS_BY_SITE] VARCHAR2(60 BYTE), [ALT_STATUS_BY_SITE] VARCHAR2(60 BYTE), [STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE),[ALT_STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE);

ALTER TABLE [EXCLUDE_BC]
ADD [STATUS_BY_SITE] VARCHAR2(60 BYTE), [ALT_STATUS_BY_SITE] VARCHAR2(60 BYTE), [STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE),[ALT_STATUS_BY_CONSOLIDATED] VARCHAR2(60 BYTE);

thanks.
regards.
Shweta

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