简体   繁体   中英

Drop table with condition - Oracle

Is it possible to drop the table with condition?

For example:

DROP table table_name where (select column from table) = (select column from table2)

NOTE: Without PLSQL

No, you can't add where in drop table statement

You will get error ORA-00933: SQL command not properly ended

I think it is not possible.

Please read the Oracle documentation:

Oracle Drop Table

I think the easiest option here would be to gather drop table statements using your conditions into a sort of script

select listagg('drop table ' || owner || '.' || table_name || ';', ' ') within group(order by 1) from all_tables where <your_condition>

and then execute it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM