drop table if exists test

Solutions on MaxInterview for drop table if exists test by the best coders in the world

showing results for - "drop table if exists test"
Flavien
21 Oct 2018
1DECLARE								-- Oracle
2    existing_table number;			
3BEGIN
4    SELECT count(*) into existing_table FROM ALL_TABLES
5    WHERE TABLE_NAME = 'table_name' AND OWNER = 'owner';
6    IF existing_table = 1 then
7        EXECUTE IMMEDIATE 'DROP TABLE owner.table_name';
8    END IF;
9END;
10/
11CREATE TABLE owner.table_name (BDAY DATE, [...]); 
Bella
27 Jun 2018
1IF EXISTS(SELECT *
2          FROM   dbo.Scores)
3  DROP TABLE dbo.Scores
4