User Tools

Site Tools


oracle删除已经存在的表_存储过程_函数等对象

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
oracle删除已经存在的表_存储过程_函数等对象 [2018/01/16 10:26]
likanghao 创建
— (current)
Line 1: Line 1:
-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;+
oracle删除已经存在的表_存储过程_函数等对象.1516069566.txt.gz · Last modified: 2021/02/10 21:29 (external edit)