[SOLVED] ORA-00942: table or view does not exist. Hints to solve the problem

Here is the solution for most common causes of Oracle SQL ORA-00942: table or view does not exist exception.

1. Problem

Below is the most common example when you got the exception.

SELECT * FROM bual; --it sholud be dual

2. Cause

  • You try execute DML/DDL operation on table which does not exists
  • You try to SELECT/INSERT/UPDATE/DELETE/ALTER etc… on table which the user does not have permission to

3. Solution

3.1 You try execute DML/DDL operation on table which does not exists

Check your spieling of used table and compare it with the reference table declaration.

Ensure that the table exists in database dictionary. At first start from query:

SELECT * 
FROM ALL_TABLES
WHERE TABLE_NAME = '<YOUR_TABLE_NAME>';

3.2 You try to SELECT/INSERT/UPDATE/DELETE/ALTER etc… on table which the user does not have permission to

If the table exists and the name of the table is the same as the referenced object ensure that the user has permission to SELECT/UPDATE/DELETE etc.. on it.

SELECT * 
FROM USER_TABLES
WHERE TABLE_NAME = '<YOUR_TABLE_NAME>';

You can grant permission to user like below:

GRANT SELECT ON <TABLE_SCHEMA>.<YOUR_TABLE_NAME> TO <USER>;
If the article was helpful to you, you can support me by:

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu