简体   繁体   中英

SQL Table does not exist

This is what happens:

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>

I can't access that table. I can make it work just fine in C#, but in the Oracle GUI and the SQL Command Line, I cannot select the table. (It's a personal, self made database using Oracle Express)

Because in user_tables the table names are written in upper and lower case letters. I assume that you created these tables using something like

create table "Discount" ...

Generally oracle saves tablenames in upper case letters and table names without double quotas are searched in uppercase. Therefore your

select * from Discount 

searches for a table named DISCOUNT and not Discount. You have to explicitly tell oracle that you want to preserve the letter case of your table names. That is done with double quotas as well. So

select * from "Discount"

should work.

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