Home » SQL & PL/SQL » SQL & PL/SQL » delete table if exist (oracle)
delete table if exist [message #575059] Fri, 18 January 2013 12:38 Go to next message
sidhu88
Messages: 1
Registered: January 2013
Junior Member
I am new here, I need help
delete table if exist

How do we write this code in oracle / sqlplus
Re: delete table if exist [message #575060 is a reply to message #575059] Fri, 18 January 2013 12:44 Go to previous messageGo to next message
BlackSwan
Messages: 22692
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/

>delete table if exist

You need to clarify the actual requirement.
You can either DELETE rows or DROP TABLE.
which action to you want to occur?

Are you unwilling or incapable to Read The Fine Manual, SQL Reference Manual, yourself?

http://docs.oracle.com/cd/E11882_01/server.112/e26088/toc.htm

Re: delete table if exist [message #575061 is a reply to message #575059] Fri, 18 January 2013 12:50 Go to previous messageGo to next message
Michel Cadot
Messages: 58861
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Just drop it, you don't need to test if it exists or not as your purpose is that it no more exists.

Regards
Michel
Re: delete table if exist [message #575072 is a reply to message #575059] Fri, 18 January 2013 22:29 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member


select tname from tab where tname like 'yourtable';

drop table youtable;

Re: delete table if exist [message #575080 is a reply to message #575072] Sat, 19 January 2013 00:52 Go to previous message
Michel Cadot
Messages: 58861
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How is this answer the question?
Did you try it?

Regards
Michel
Previous Topic: Query Problem (merged)
Next Topic: logic for procedure
Goto Forum:
  


Current Time: Sat Aug 23 11:11:15 CDT 2014

Total time taken to generate the page: 0.09963 seconds