简体   繁体   中英

Oracle SQL Developer: PL/SQL: ORA-00903: invalid table name

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"?

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 .

But you should

DELETE FROM book_copies;

(no * borrowed from Access)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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