DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Deleting tables from a schema

  1. #1
    Join Date
    Aug 2002
    Posts
    43
    What's the command for deleting all data from a schema? I don't want to drop the schema.

    Thanks

  2. #2
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    I don't think you can just drop the objects of a schema (unless you write a script to list them all with the corresponding drop statements) with a single command execpt DROP USER

    Regards
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  3. #3
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    try this

    spool drop objects
    set head off
    select 'drop ' || object_type ||' '|| object_name||';' from user_objects where object_type in ('TABLE','PACKAGE','TRIGGER','SEQUENCE','VIEW');
    spool off



    then edit the spool file to get rid of the junk and run it.

  4. #4
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    should be spool drop_objects

  5. #5
    Join Date
    May 2002
    Posts
    2,645
    Not to be picky, but what do you mean by data? Data, or objects - which includes tables, which in turn, includes data?

    Are you asking how to purge data, but leave the basic structure of the schema intact?

    From other post, you would also include package body as an object type.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width