Not able to select a table even if having SELECT privilege

倖福魔咒の 提交于 2019-12-02 18:09:43

问题


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?


回答1:


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');


来源:https://stackoverflow.com/questions/18999240/not-able-to-select-a-table-even-if-having-select-privilege

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!