Home » Oracle » Oracle Database » How to Solve ORA-00942 table or view does not exist

How to Solve ORA-00942 table or view does not exist

ORA-00942 is one of the many errors which Oracle developer ,Oracle DBA often gets.

Lets first look at the OERR output

ORA-00942 table or view does not exist

Cause: The Oracle table or Oracle view entered does not exist, a synonym that is not allowed here was used, or a view was referenced where a table is required.

Existing user tables and views can be listed by querying the data dictionary. Certain privileges may be required to access the table. If an application returned this message, the table the application tried to access does not exist in the database, or the application does not have access to it.

Action: Check each of the following:

  • the spelling of the table or view name.
  • that a view is not specified where a table is required.
  • that an existing table or view name exists.
  • Contact the database administrator if the table needs to be created or
    if user or application privileges are required to access the table.

Checklist to run for ORA-00942

(1) If you user owns the table or view ,check for spelling mistakes. Query User_objects to check if the table or view exists

select object_name,object_type from user_objects;

(2) If you dont own the table or view, check if you have permission for the table or view. Query all_objects to check if the table or view you are querying is having permission

select * from all_objects where object_type in ('TABLE','VIEW') and object_name = '&1';

If it is not shown here, it means you dont have access to that particular view.You have to get access for the view for the table

GRANT privileges ON object TO user;

Following access can be granted

See also  What is Undo and redo in Oracle database

If the synonym is not created , then you have to use the owner.<table_name>  to access the  table

Desc <owner>.<table_name>

select * from <owner>.<table_name>;

You can create public synonym using the below command

create public synonym exp_table for test.exp_table

(3) ORA-00942 may also occurs while refreshing a Oracle Materialized viewsORA-00942

You  will need to check all the tables in the materialized query to find out the issue. You can use sql trace to find that

Sometimes while creating the table,special character get copied ,So you may get this error. Check the table name in all_tables and then act accordingly.

Related Articles
ORA-00936 missing expression
ORA-00904: invalid identifier
ORA-00257: archiver error. Connect internal only, until freed.
ORA-06512 at line num
Oracle Create table
ORA-00911: invalid character
Oracle documentation

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top