当前位置: 代码迷 >> SQL >> PL/SQL 剔除对象
  详细解决方案

PL/SQL 剔除对象

热度:114   发布时间:2016-05-05 14:25:35.0
PL/SQL 删除对象
删除数据库中所有的表
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改了就行。
  相关解决方案