ORA-00942 table or view does not exist

ORA-00942 table or view does not exist
Cause: The table or 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.

Also, if attempting to access a table or view in another schema, make certain the correct schema is referenced and that access to the object is granted.

Reference: Oracle Documentation

ORA-00942 is a very common exception while executing any SQL Statement on database. ORA-00942 may also occurs while refreshing a MVIEW. ORA-00942 may occur due to one of the following reasons
1. Table or view used in SQL statement does not exist in schema.
2. Incorrect Spelling for table or view used in SQL Statement.
3. Do not have privilege to access the table or view.
4. Forgot to add reference of schema name for the table which is in another schema.
5. Table has been dropped/renamed which is being used in materialized view.


To provide the privilege to access a table to a user use following command
- grant select on table_name to user_name;
- grant all on table_name to user_name;

No comments:

Post a Comment