Get the App
SLTechnology News&Howtos  ›  Database  › 

How to delete multiple tables with one statement in the database

Shulou Source: shulou.com Published: 2022-05-31 15:21:17 11月01日 Update

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!

Tags: Multiple data database statement content method article value interest name guy partner more knowledge industry information information channel channel reference help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology Shulou Tech Info OPPO Reno vpn