日期:2014-05-16  浏览次数:20392 次

oracle删除某个用户下的对象
删除某个用户下的对象,实际上就是拼装查询几张系统表,将结果拷出来执行一下。
--Drop constraint  
select 'alter table ' || table_name || ' drop constraint ' ||  constraint_name || ' ;'  from user_constraints where constraint_type = 'R';  
     
--Drop tables  
select 'drop table ' || table_name || ';' from user_tables;
      
--Drop view  
select 'drop view ' || view_name || ';' from user_views;  
    
--Drop procedure  
select 'drop procedure ' || object_name || ';'  from user_procedures where object_type = 'PROCEDURE';  
     
--Drop function  
select 'drop function ' || object_name || ';' from user_procedures where object_type = 'FUNCTION';  
     
--Drop sequence  
select 'drop sequence ' || sequence_name || ';' from user_sequences;