删除数据库中所有的表
declare CURSOR cur_tab is select table_name from user_tables; BEGIN FOR v_name IN cur_tab LOOP execute immediate 'drop table ' || v_name.table_name || ' Cascade Constraints'; END LOOP; end;
删除所有procedure
declare 2 CURSOR cur_pro is select object_name from user_objects where object_type='PROCEDURE'; 3 BEGIN 4 FOR v_name IN cur_pro LOOP 5 execute immediate 'drop PROCEDURE' || v_name.object_name; 6 END LOOP; 7 end; 8 /
其他view,sequence,index,function都一样。只是把object_type改了就行。