Home > Mobile >  How to grant privilege to a row in Oracle?
How to grant privilege to a row in Oracle?

Time:03-12

I'm just start learning about Oracle database. I want to ask that how can I grant privilege to a row. For example: employee A just can read, update info about him and he can't read info about employee B or others
Here is my table Employee

     create table Employee(
        Emp_ID varchar2(20),
        Emp_Name varchar2(255),
        primary key(Emp_ID)
     )

CodePudding user response:

You can add a Data_Owner field to the table populated by the USER function. Don't allow direct access to the table. All access is through a view that exposes only those rows matching the USER value of whoever queries the view. Use the USER function to control the DML.

Here is a sample. Test to see if it meets your needs

create view Sample as
select col_1, col_2, col3
from   Sample_Table
where  Data_Owner = USER;

  • Related