Oracle中,删除一个用户下的所有表

你需要创建这些删除语句,通过oracle的数据字典找到该用户下的所有表、视图等对象,拼接成语句。
如下
select 'drop table ' || table_name ||';'||chr(13)||chr(10) from user_tables;  --delete tablesselect 'drop view ' || view_name||';'||chr(13)||chr(10) from user_views;  --delete viewsselect 'drop sequence ' || sequence_name||';'||chr(13)||chr(10) from user_sequences;--delete seqsselect 'drop function ' || object_name||';'||chr(13)||chr(10) from user_objects  where object_type='FUNCTION';--delete functionsselect 'drop procedure ' || object_name||';'||chr(13)||chr(10) from user_objects  where object_type='PROCEDURE';--DELETE PROCEDUREselect 'drop package ' || object_name||';'||chr(13)||chr(10) from user_objects  where object_type='PACKAGE';--delete pags

你可能感兴趣的:(oracle)