Cyber
Cyber

Reputation: 15

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

Upvotes: 1

Views: 423

Answers (3)

ekochergin
ekochergin

Reputation: 4129

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

Upvotes: 1

Ori Marko
Ori Marko

Reputation: 58772

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

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

Upvotes: 3

Viktor T&#246;r&#246;k
Viktor T&#246;r&#246;k

Reputation: 1319

I think it is not possible.

Please read the Oracle documentation:

Oracle Drop Table

Upvotes: 1

Related Questions