How can drop table if table exists in oracle?
<p>I am trying to create database by my java application using my generated schema file. In schema I have included drop query also. But I want to do some improvements for DROP QUERY. So I want to check the existence of db objects before running drop query and drop only when if it exists.
I googled for it and found some oracle link, Some link suggest following syntax and some mentioned that <a href="http://ora-exp.blogspot.in/2013/03/oracle-drop-table-if-exists.html" rel="nofollow">ORACLE does not support such syntax</a>.</p>

<pre><code> SYNTAX A: 
IF EXISTS DROP TABLE TABLE_NAME

SYNTAX B:
DROP [TEMPORARY] TABLE [IF EXISTS]
        tbl_name [, tbl_name] ...
        [RESTRICT | CASCADE]
</code></pre>

<p>I also tried following queries:-</p>

<pre><code>IF EXISTS (SELECT * FROM dba_objects WHERE OBJECT_NAME = 'BBB'  )
DROP TABLE [BBB]
</code></pre>

<p>but it was giving error:-</p>

<pre><code>Error starting at line 2 in command:
DROP TABLE [BBB]
Go
Error report:
SQL Error: ORA-00903: invalid table name
00903. 00000 -  "invalid table name"
*Cause:    
*Action:

Error starting at line 1 in command:
IF EXISTS (SELECT * FROM dba_objects WHERE OBJECT_NAME = 'BBB'  ) DROP TABLE [BBB]
Error report:
Unknown Command
</code></pre>

<p>I refered following links:-
<a href="https://community.oracle.com/thread/2421779?tstart=0" rel="nofollow">https://community.oracle.com/thread/2421779?tstart=0</a> </p>

<p><strong>Please suggest me if there any other queries to drop table with condition if table exists.</strong></p>