문제

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?

도움이 되었습니까?

해결책

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');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top