Truncating a table

posted Jul 25, 2011, 8:15 AM by Sachchida Ojha


1)      You can truncate a table if you are the user who created it.

2)      You can truncate a table if other user has created the table via a execute privilege on procedure in other schema which truncates a table.

create or replace procedure <tableowner>.proc_truncate_<table_name>
as begin
execute immediate 'truncate table <tableowner>.<table_name>';
end;
/

grant execute on <tableowner>.<tableowner>.proc_truncate_<table_name> to <another_user>
/


Comments