Oracle如何将表中的某些数据限制为不同的用户?(How can Oracle restrict certain data on a table to different users?)
搜索该网站,似乎没有发现有人问过这个问题。
我们有两个帐户访问同一模式/数据库上的同一个表。 User_1帐户能够撤回所有记录,而User_2帐户只能撤回某些数据。
我知道Oracle能够限制不同用户的表访问,但我不知道它可以在数据级别上做这样的事情。
我的问题是Oracle可以这样做吗?
谢谢
Searched the site and doesn't seem to find anyone had asked this question.
We have two accounts accessing the same table on the same schema/database. User_1 account was able to pull back all the records while User_2 account were only able to pull back certain data.
I am aware that Oracle has the ability to restrict table access for different users but I am not aware it can do something like this on the data level.
My question is can Oracle do this and how?
Thanks
最满意答案
您可以使用视图。
CREATE OR REPLACE VIEW V_TABLE_FOR_USER_2 AS SELECT * FROM THE_TABLE WHERE {data} = {certain data}; GRANT SELECT, INSERT, DELETE, UPDATE ON THE_TABLE TO USER_1; GRANT SELECT, INSERT, DELETE, UPDATE ON V_TABLE_FOR_USER_2 TO USER_2;You can work with a view.
CREATE OR REPLACE VIEW V_TABLE_FOR_USER_2 AS SELECT * FROM THE_TABLE WHERE {data} = {certain data}; GRANT SELECT, INSERT, DELETE, UPDATE ON THE_TABLE TO USER_1; GRANT SELECT, INSERT, DELETE, UPDATE ON V_TABLE_FOR_USER_2 TO USER_2;更多推荐
发布评论