甲骨文 |删除表
我想删除表空间中的某些表,这些表的公共名称附加到每个表的末尾,例如:
TABLE1_NAME1_COMMON
TABLE2_NAME2_COMMON
TABLE3_NAME3_COMMON
我听说过 Oracle 函数,但我对这些函数不太熟悉,所以我期待一些帮助。
谢谢。
I want to drop certain tables in a tablespace that has common name appended to end of each table for an example:
TABLE1_NAME1_COMMON
TABLE2_NAME2_COMMON
TABLE3_NAME3_COMMON
I heard about Oracle functions but I'm not familiar much with those so I'm expecting some helping hand.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您完全确定自己在做什么,即,如果您确定没有意外删除不想删除的表,则可以执行以下操作:
编辑 :
user_tables
而不是dba_tables
选择,因为这样做似乎更安全。set serveroutput on
以便打印dbms_output.put_line
begin .. exception .. end
以便显示错误。If you're completely sure what you're doing, ie, if you're sure that you don't accidentally drop a table that you don't want to drop, you can do a:
Edit:
user_tables
instead ofdba_tables
as it seems more safe to do.set serveroutput on
in order fordbms_output.put_line
to be printedbegin .. exception .. end
in order for errors to be shown.您可以在过程中执行此操作,但最好只选择那些
DROP
语句,查看它们并手动执行它们:将返回
You could do that in a procedure, but it might be better to just select those
DROP
-statements, review them and execute them manually:would return
要识别它们,您可以使用:
然后您可以使用 SELECT 派生 DROP 语句。或者您可以编写一个 PL/SQL 函数来循环遍历“公用表”并使用 EXECUTE IMMEDIATE 删除它们。
不过,我首先要确保您对选择有 100% 的把握。
to identify them you can use:
You could then either, derive your DROP statements using a SELECT. Or you could write a PL/SQL function to loop through the "Common Tables" and DROP them using EXECUTE IMMEDIATE.
I would make sure you are 100% sure in the selections first however.