Question

I have two users, USER1 and USER2. USER1 has privilege to create table and USER2 does not have this privilege.

USER1 has created a table called EMPLOYEE and granted the select privilege on that table to USER2:

====== Using USER1 credentials =======

1) Create table-

CREATE TABLE EMPLOYEE
(
   EMP_ID NUMBER,
   EMP_NAME VARCHAR2 (20 BYTE)
);

2) Grant permission to user2

GRANT SELECT ON EMPLOYEE TO USER2;

====== Using USER2 credentials =======

Now I want to access the EMPLOYEE table using USER2 credentials:

SELECT * from EMPLOYEE

But it is giving error:

ORA-00942: table or view does not exist

Please tell me what I am doing wrong here?

Was it helpful?

Solution

Try this

SELECT * from USER1.EMPLOYEE;

This might happen if there is no public synonym present for EMPLOYEE table. So you need to refer using the owner.object

If not getting results, please post the results of

SELECT
      OWNER,
      TABLE_NAME
FROM
      ALL_TABLES
WHERE
      TABLE_NAME IN ('EMPLOYEE');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top