Possible duplicate:SQL Server: check if theOracle table exists: if the table exists
I am trying to create a table and insert some values, but before I do this, I have to make sure that the table does not exist yet. How do you do this?
You can simply select SELECT from it and capture the error, otherwise you will need to write a specific SQL SQL to query their respective metadata tables and look there.
IF MySQL:
select count(*) from my_tables where table_name='table_1'; If count>0 then ...
SQL Server... Query sysobjects:
select * from sysobjects where xtype='U' and name ='tablename'
MySQL CREATE TABLE IF NOT EXISTS INSERT. , , .
CREATE TABLE IF NOT EXISTS myTable ( .... )
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
http://docs.oracle.com/cd/E17952_01/refman-5.1-en/create-table.html
This simple query gives you detailed information about a specific table created by users in oracle. Give it a try.
select * from user_tables where table_name = 'tablename';