Friday 15 June 2018

"ORA-00942: table or view does not exist" when try to get data using synonym


This document describes about "ORA-00942: table or view does not exist" issue while trying to get data using synonym

Issues:

SQL> show user

USER is "ADAM"

SQL> create synonym emp for scott.emp;

Synonym created.

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

Cause and Solution:

Issue is coming because user ADAM does not have select privilege  on emp table which is under scott schema.

Connect to sys user and grant select privilege on scott.emp table to adam.

SQL> conn sys as sysdba
Enter password:
Connected.

SQL> grant select on scott.emp to adam;

Grant succeeded.

Validation:

SQL> show user
USER is "ADAM"

SQL> select count(*) from emp;

  COUNT(*)
----------
14

SQL> 



Thanks for your patience to review the post............

No comments:

Post a Comment