Oracle如何将表中的某些数据限制为不同的用户?(How can Oracle restrict certain data on a table to different users?)

编程入门 行业动态 更新时间:2024-10-10 15:20:38
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;

更多推荐

本文发布于:2023-07-27 15:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1292346.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   数据   用户   Oracle   users

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!