能否grant select某几列给一个用户?

[复制链接]
查看11 | 回复9 | 2019-4-13 23:36:38 | 显示全部楼层 |阅读模式
看到有人这样写了两段话, 有点意思
/*授予对象中的某些字段的权限,如select 某表中的某些字段的权限*/
grant [object_privs(column,....)],[...] on object_name to user/role/public,... with grant option;
/*oracle不允许授予select某列的权限,但可以授insert ,update某列的权限*/
grant insert(column_name1,column_name2,...) on table_name to user_name with grant option;


回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
建个视图,只包含这几列
然后grant select on 视图给他
呵呵,视图这样用是比较合适的一种方式。
回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
太聪明了, 怎么没想到呢, 哈哈
多谢~
grant 是否能只grant select 某几列?
回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
grant select on 某几列
这种是不行的
回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
最初由 Laurence.li 发布
[B]建个视图,只包含这几列
然后grant select on 视图给他
呵呵,视图这样用是比较合适的一种方式。 [/B]

学习了!
回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
学习了
回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
喜欢学习的朋友也应该鼓励一下, 给点好评


回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
另外问下, view跟table都是grant给另一个用户, 他们的区别在哪边?
性能上的还是安全上的?
回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
column
Specify the table or view column on which privileges are to be granted. You can specify columns only when granting the INSERT, REFERENCES, or UPDATE privilege. If you do not list columns, then the grantee has the specified privilege on all columns in the table or view.

要看ref,免得走弯路
回复

使用道具 举报

千问 | 2019-4-13 23:36:38 | 显示全部楼层
前几天grant了一个function时还想问一下, 这个References都包含了哪些privs, 不太会用..
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行