Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Truncate all tables in schema

3073Jan 18 2006 — edited Jan 18 2006
Hi,
I want to truncate all tables (300 tables) in a schema. There are some enabled constraints in this schema. I want to keep all tables attached objects (like indexes, constraints, etc). I’d like to create a procedure to do this job. What's the safe and right way for this?

I am thinking as follows:
1- Retrieve all user constraints name using user_constrants view and then disable them.
2- Retrieve all user tables name using user_tables view and then Truncate them.
3- Enable all constraints that were disabled in step 1.

Is this a safe and right way?
Let me know your thought please. Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2006
Added on Jan 18 2006
14 comments
16,918 views