Create a table
Add a couple of records.
USR_2
is allowed to select
from the table and to update two columns: col_2
and col_3
.
connect usr_1/pw_1
create table tab_1 (
col_1 number,
col_2 varchar2(10),
col_3 varchar2(10),
col_4 varchar2(10)
);
insert into tab_1 values (1, 'one', 'foo', 'important');
insert into tab_1 values (2, 'two', 'bar', 'data!' );
grant select,
update( col_2, col_3)
on tab_1
to usr_2;
Updating the table
USR_2
is only able to update col_2
and col_3
.
update
usr_1.tab_1
set
col_2 = 'TWO'
where
col_1 = 2;
--
-- ORA-01031: insufficient privileges
--
-- update
-- usr_1.tab_1
-- set
-- col_4 = '***'
-- where
-- col_1 = 1;