1. 程式人生 > >儲存過程(七)批量刪除表

儲存過程(七)批量刪除表

create or replace procedure test_005 is 
vSql varchar2(2000); 
vSql2 varchar2(2000); 


vTable_bak varchar2(50); 
vTable2_bak varchar2(50); 



vgrant varchar2(100); 
begin 
vgrant:='grant create table to cmbcnetuser'; 
execute immediate vgrant; 

for m in 0..9 loop 
for n in 0..9 loop 


vTable_bak := 'user_role_'||m||'_'||n||'_bak'; 


vTable2_bak := 'user_role_attribute_'||m||'_'||n||'_bak'; 

vSql := 'drop table '||vTable_bak; 

vSql2 := 'drop table '||vTable2_bak ; 
-- dbms_output.put_line(vSql); 


execute immediate vSql; 

execute immediate vSql2; 



end loop; 
end loop; 

end test_005;