Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to delete multiple tables with one statement in the database

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to delete multiple tables with one sentence in the database, which is very detailed and has a certain reference value. Friends who are interested must finish reading it!

The first method:

SCOTT@PROD > select 'drop table' | | table_name | |'; 'from user_tables

'DROPTABLE' | | TABLE_NAME | |';'

-

Drop table DEPT

Drop table EMP

Drop table BONUS

Drop table SALGRADE

Drop table T1

Drop table DEPT1

Drop table EMP1

Drop table TBS1

Drop table T

Drop table T_MERGE

Drop table DEPT_M

Drop table EMP1_EXT

Drop table INV_HISTORY

Drop table T2

14 rows selected.

The second method:

Begin

For rec in (select table_name

From user_tables-can be changed to all_name

Where table_name like'% TEST%'-change the name of the table

)

Loop

Execute immediate 'drop table' | | rec.table_name

End loop

End

The above is all the contents of the article "how to delete multiple tables in a single statement in the database". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report