There are two solutions, drop any table or create procedure, the first drop any table contains drop any table and truncate any table, if you don't want drop any table permissions, create truncate procedure is a better solution.
Solution 1.
Grant drop any table to schema2
SQL> GRANT DROP ANY TABLE TO schema2;
Solution 2.
create truncate table procedure on schema1
SQL> CREATE OR REPLACE procedure truncate_table(table_name varchar2) is begin execute immediate 'truncate table ' || table_name || ''; end; /
grant execute procedure privilege to schema2
SQL> grant execute on schema1.truncate_table to schema2;
execute truncate procedure
--login user schema2 --a. begin end; begin schema1.truncate_table('TEST'); end; / --b. call or execute call schema1.truncate_table('test'); execute schema1.truncate_table('test');
0 留言