Grant alter on only one column in table

心不动则不痛 提交于 2019-12-09 08:21:48

问题


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.


回答1:


For example, you want to grant update privilege on ename column only, then give the following statement (where xyz is the username)

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.

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:

grant update (ename),insert (empno, ename)  on emp to xyz;



回答2:


Based on this source:

Only INSERT, UPDATE, and REFERENCES privileges can be granted at the column level. When granting INSERT at the column level, you must include all the not null columns in the row.

Here is an example:

GRANT update (column_name) ON table_name TO user_name;


来源:https://stackoverflow.com/questions/14462353/grant-alter-on-only-one-column-in-table

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