oracle – 如何删除所有用户表?

前端之家收集整理的这篇文章主要介绍了oracle – 如何删除所有用户表?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何删除所有用户表在oracle?

我有限制的问题。当我禁用所有它仍然是不可能的。

BEGIN
   FOR cur_rec IN (SELECT object_name,object_type
                     FROM user_objects
                    WHERE object_type IN
                             ('TABLE','VIEW','PACKAGE','PROCEDURE','FUNCTION','SEQUENCE'
                             ))
   LOOP
      BEGIN
         IF cur_rec.object_type = 'TABLE'
         THEN
            EXECUTE IMMEDIATE    'DROP '
                              || cur_rec.object_type
                              || ' "'
                              || cur_rec.object_name
                              || '" CASCADE CONSTRAINTS';
         ELSE
            EXECUTE IMMEDIATE    'DROP '
                              || cur_rec.object_type
                              || ' "'
                              || cur_rec.object_name
                              || '"';
         END IF;
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line (   'Failed: DROP '
                                  || cur_rec.object_type
                                  || ' "'
                                  || cur_rec.object_name
                                  || '"'
                                 );
      END;
   END LOOP;
END;
/@H_502_8@

猜你在找的Oracle相关文章