This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
oracle删除已经存在的表_存储过程_函数等对象 [2018/01/18 00:05] jordan 移除 |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ```sql | + | |
- | BEGIN | + | |
- | FOR cur_rec IN (SELECT object_name, | + | |
- | FROM user_objects | + | |
- | WHERE object_type IN | + | |
- | | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | )) | + | |
- | | + | |
- | BEGIN | + | |
- | IF cur_rec.object_type = ' | + | |
- | | + | |
- | EXECUTE IMMEDIATE | + | |
- | || cur_rec.object_type | + | |
- | || ' "' | + | |
- | || cur_rec.object_name | + | |
- | || '" | + | |
- | | + | |
- | EXECUTE IMMEDIATE | + | |
- | || cur_rec.object_type | + | |
- | || ' "' | + | |
- | || cur_rec.object_name | + | |
- | || '"'; | + | |
- | END IF; | + | |
- | EXCEPTION | + | |
- | WHEN OTHERS | + | |
- | | + | |
- | DBMS_OUTPUT.put_line ( ' | + | |
- | || cur_rec.object_type | + | |
- | || ' "' | + | |
- | || cur_rec.object_name | + | |
- | || '"' | + | |
- | ); | + | |
- | END; | + | |
- | END LOOP; | + | |
- | END; | + | |
- | ``` | + |