database 仅对表中的一列授予更改权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/14462353/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Grant alter on only one column in table
提问by Vincenz M?ssenb?ck
I want to grant a user only to edit one column in my table. What command do I use here? I use the oracle 11g database. I alrdy know how I can grant only read or delete on the whole table but how do I do it for only one column or more? pls give an example.
我只想授予用户编辑表格中的一列的权限。我在这里使用什么命令?我用的是oracle 11g 数据库。我已经知道如何只对整个表授予读取或删除权限,但如何仅对一列或更多列执行此操作?请举个例子。
回答by Vinayak Pahalwan
For example, you want to grant update privilege on ename column only, then give the following statement (where xyz is the username)
例如,您只想授予对 ename 列的更新权限,然后给出以下语句(其中 xyz 是用户名)
grant update (ename) on emp to xyz;
Syntax:
句法:
grant update(column-name) on table-name to user-name
EDIT:(for granting select privilege)
编辑:(用于授予选择权限)
To grant select statement on emp table to XYZ and to make XYZ be able to further pass on this privilege you have to give WITH GRANT OPTION clause in GRANT statement like this.
要将 emp 表上的 select 语句授予 XYZ 并使 XYZ 能够进一步传递此权限,您必须像这样在 GRANT 语句中提供 WITH GRANT OPTION 子句。
grant select on emp to xyz with grant option;
Also, For example you want to grant update privilege on ename column only and insert privilege on empno and ename columns only, you can do this:
此外,例如,您只想授予对 ename 列的更新权限并仅对 empno 和 ename 列授予插入权限,您可以执行以下操作:
grant update (ename),insert (empno, ename)  on emp to xyz;
回答by maialithar
Based on this source:
基于此来源:
Only INSERT, UPDATE, and REFERENCESprivileges can be granted at the column level. When granting INSERTat the column level, you must include all the not null columns in the row. 
只有INSERT,UPDATE和REFERENCES权限可以在列级授予。INSERT在列级别授予时,您必须在行中包含所有非空列。
Here is an example:
下面是一个例子:
GRANT update (column_name) ON table_name TO user_name;

