What does Oracle error ORA-00942 indicate, and what can I do about it?

book

Article ID: 159470

calendar_today

Updated On:

Products

Data Loss Prevention Enforce

Issue/Introduction

This error will more than likely appear while running a script in SQLPlus or in a log file.

ORA-00942 indicates that an object does not exist, which is the result of one of two conditions:

1) the specified object really does not exist,

2) the object was created and is owned by another Oracle user; a user different from the one you used to attempt to access the object.

Resolution

This error can be remediated a number of ways:

1) Find and use the account that owns the object.

SQL> connect sys as sysdba

SQL> select count(*) from message;

select count(*) from message
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> connect protect

SQL> select count(*) from message;

  COUNT(*)
----------
         1

2) Explicitly name the owner and object:

SQL> connect sys as sysdba

SQL> select count(*) from message;

select count(*) from message
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select count(*) from PROTECT.message;

  COUNT(*)
----------
         1