Sunday, October 9, 2011

Truncate privilege to user b on tables of user A


Request: Need to provide truncate privilege to user B on table A.test_table.

1) Connect to user A

2) Create procedure to truncate table as below:

create or replace procedure truncate_test_table
as
l_sql varchar2(2500); 
begin
l_sql := 'TRUNCATE TABLE A.TEST_TABLE'; 
execute immediate l_sql; 
end; 

2) Grant the procedure to User B:

grant execute on A.truncate_test_table to b;

3) Try executing the procedure from User B as below:

begin
A.truncate_test_table; 
end; 

No comments:

Post a Comment