GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  Database Administration
Go To First  |  Previous Question  |  Next Question 
 Database Administration  |  Question 123 of 231    Print  
Is it possible to drop more than one table using single sql statement? if yes then how.

  
Total Answers and Comments: 5 Last Update: July 02, 2009     Asked by: ambrish20 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: senthilora
 
That is not correct Abhishek reddy..:)

Spool is not a SQL statement.  Moreover, actually you are creating multiple SQL statements and executing them.

No - would be my answer if the question was "is that possible to drop more than one table by using single DROP TABLE statement"

Yes - is my answer as "DROP USER .. CASCADE" statement will drop all the tables at once owned by a specific user. 


Above answer was rated as good by the following members:
neelapu
April 22, 2007 04:51:10   #1  
subash        

RE: Is it possible to drop more than one table using s...
No because we can drop only one table or table data by using drop.
 
Is this answer useful? Yes | No
May 06, 2007 16:17:58   #2  
abhishek reddy        

RE: Is it possible to drop more than one table using s...
Yes we can drop more than 1 table using spool.


Dropping all tables from a user:----

sql> select 'drop table' || 'tname' || from tab;

sql> spool pp;

//copy all the data from all the tables//

sql>spool off;

sql> @pp.lst


 
Is this answer useful? Yes | No
September 24, 2007 11:36:18   #3  
senthilora        

RE: Is it possible to drop more than one table using s...
That is not correct Abhishek reddy..:)

Spool is not a SQL statement. Moreover actually you are creating multiple SQL statements and executing them.

No - would be my answer if the question was is that possible to drop more than one table by using single DROP TABLE statement

Yes - is my answer as DROP USER .. CASCADE statement will drop all the tables at once owned by a specific user.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 05, 2008 14:53:11   #4  
abdulraheem_ar Member Since: August 2008   Contribution: 2    

RE: Is it possible to drop more than one table using single sql statement? if yes then how.
Try using substitution variable like

DROP TABLE &table_name

 
Is this answer useful? Yes | No
July 02, 2009 18:43:56   #5  
skranof Member Since: July 2009   Contribution: 1    

RE: Is it possible to drop more than one table using single sql statement? if yes then how.
I assume you already figured this out but if not

simply

use dbName
go

drop table table1 table2 table3

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape