Answers for "drop table if exists test"

SQL
1

drop table if exists test

DECLARE								-- Oracle
    existing_table number;			
BEGIN
    SELECT count(*) into existing_table FROM ALL_TABLES
    WHERE TABLE_NAME = 'table_name' AND OWNER = 'owner';
    IF existing_table = 1 then
        EXECUTE IMMEDIATE 'DROP TABLE owner.table_name';
    END IF;
END;
/
CREATE TABLE owner.table_name (BDAY DATE, [...]);
Posted by: Guest on August-27-2021
0

if table exists drop

IF EXISTS(SELECT *
          FROM   dbo.Scores)
  DROP TABLE dbo.Scores
Posted by: Guest on July-04-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language