SQL 表不存在

use*_*698 1 sql oracle

这是发生的事情:

SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
Discount
Taxes
Customer
Vehicles
WorkOrder
Task
TaskPart
Employee
EmplyeeTask
WorkOrderPart
InvoiceDetails

TABLE_NAME
------------------------------
Invoice
Parts
InvoicePrimaries

14 rows selected.

SQL> select * from Discount;
select * from Discount
              *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL>
Run Code Online (Sandbox Code Playgroud)

我无法访问该表。我可以让它在 C# 中正常工作,但在 Oracle GUI 和 SQL 命令行中,我无法选择表。(这是一个使用 Oracle Express 的个人自制数据库)

wum*_*mpz 5

因为在user_tables表中名称是用大写和小写字母写的。我假设您使用类似的东西创建了这些表

create table "Discount" ...
Run Code Online (Sandbox Code Playgroud)

通常oracle 将表名保存为大写字母,没有双配额的表名以大写字母搜索。因此你的

select * from Discount 
Run Code Online (Sandbox Code Playgroud)

搜索名为 DISCOUNT 而不是 Discount 的表。您必须明确告诉 oracle 您要保留表名的字母大小写。这也是通过双配额完成的。所以

select * from "Discount"
Run Code Online (Sandbox Code Playgroud)

应该管用。