刪除目前使用者的所有對象(表、視圖、觸發器、預存程序、函數),目前使用者觸發器

來源:互聯網
上載者:User

刪除目前使用者的所有對象(表、視圖、觸發器、預存程序、函數),目前使用者觸發器


 

DECLARE
TYPE name_list IS TABLE OF VARCHAR2(40);
TYPE type_list IS TABLE OF VARCHAR2(20);

Tab_name name_list:=name_list();
Tab_type type_list:=type_list();

sql_str VARCHAR2(500);
BEGIN
sql_str := 'select uo.object_name,uo.object_type from user_objects uo where uo.object_type not in(''INDEX'',''LOB'') order by uo.object_type desc';
EXECUTE IMMEDIATE sql_str BULK COLLECT INTO tab_name,tab_type;

FOR i IN Tab_name.FIRST.. Tab_name.LAST LOOP
sql_str := 'DROP ' || Tab_type(i) || ' ' || Tab_name(i);
EXECUTE IMMEDIATE sql_str;
END LOOP;
END;

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.