Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

oracle create table if not exists

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, [...]); 
 
PREVIOUS NEXT
Tagged: #oracle #create #table #exists
ADD COMMENT
Topic
Name
1+5 =