Q
Problem solve Get help with specific problems with your technologies, process and projects.

CASCADE CONSTRAINTS clause for dropping tables

In your answer to drop all tables with one command you overlooked the relationships between tables. Therefore you would need to add on a CASCADE CONSTRAINTS clause. Would you not?

In your answer to drop all tables with one command you overlooked the relationships between tables. Therefore you would need to add on a CASCADE CONSTRAINTS clause. Would you not?
Good point. In my answer to drop all of the tables, I create a script called "drop_tables.sql" and then run that script. If you have foreign key constraints, parent tables cannot be dropped if child records exist. So my "trick" has been to simply run the drop_tables.sql script twice in a row. The first time, all of the child tables will be dropped. The second time, the parent tables will be dropped. You could also add the CASCADE CONSTRAINTS clause to the DROP TABLE command as well. Both approaches will accomplish the same goal.

Dig Deeper on Oracle and SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close