Search
 
SCRIPT & CODE EXAMPLE
 

SQL

create table if not exists sql

CREATE TABLE IF NOT EXISTS

> CREATE TABLE IF NOT EXISTS TEAMS
> (TEAMNO      INTEGER NOT NULL PRIMARY KEY,
> EmployeeNO    INTEGER NOT NULL,
> DIVISION    CHAR(6) NOT NULL);
Comment

SQL CREATE TABLE IF NOT EXISTS

CREATE TABLE IF NOT EXISTS Companies (
  id int,
  name varchar(50),
  address text,
  email varchar(50),
  phone varchar(10)
);
Comment

create table if not exists

create table if not exists schema_uploadfile.tbl_uploadfile(
	id serial primary key,
	file_name varchar(255) unique,
	file_type varchar(30),
	grp_data bytea
);
Comment

Create table if not exist

declare
nCount NUMBER;
v_sql LONG;

begin
SELECT count(*) into nCount FROM dba_tables where table_name = 'EMPLOYEE';
IF(nCount <= 0)
THEN
v_sql:='
create table EMPLOYEE
(
ID NUMBER(3),
NAME VARCHAR2(30) NOT NULL
)';
execute immediate v_sql;

END IF;
end;
Comment

Create table if not exist with exceptions

declare
v_sql LONG;
begin

v_sql:='create table EMPLOYEE
  (
  ID NUMBER(3),
  NAME VARCHAR2(30) NOT NULL
  )';
execute immediate v_sql;

EXCEPTION
    WHEN OTHERS THEN
      IF SQLCODE = -955 THEN
        NULL; -- suppresses ORA-00955 exception
      ELSE
         RAISE;
      END IF;
END; 
/
Comment

PREVIOUS NEXT
Code Example
Sql :: timestamp type in sql 
Sql :: sql query interview questions githu 
Sql :: primary key 
Sql :: between in sql 
Sql :: oracle alter table 
Sql :: How to solve "Error: MySQL shutdown unexpectedly"? 
Sql :: what is ssrs and ssis in sql server 
Sql :: identity column in sql server 
Sql :: postgres add foreign key to existing table 
Sql :: convert sql to linq c# online 
Sql :: postgres duplicate database in same server while other session is using source database 
Sql :: set identity_insert off 
Sql :: System.Diagnostics.Process is not supported on this platform 
Sql :: ajax error exception handeling 
Sql :: delete from table and truncate table 
Sql :: SQL - Row Number into Alphabetical characters 
Sql :: db connection using sql client in dot net 
Sql :: HOW to select specific table data from an mysql databse server: 
Sql :: SQL authentication error 
Sql :: oracle allow space to user 
Sql :: <connectionStrings <add name="MainDB" connectionString="Data Source=multidc02.its.com.pk,47328;Initial Catalog=ITSGeneralApplications;User ID=ITSGeneralAdmin;Password=TDsHn6TTyJohXCe"/ </connectionStrings 
Sql :: get statis values sql 
Sql :: sql query between datetime 
Sql :: mysql top percent 
Sql :: drop unique constraint 
Sql :: oracle procedure chain step 
Sql :: sparql comment multiline 
Sql :: close sql query vb.net 
Sql :: Time difference in hh:mm:ss 
Sql :: select month from date in sql 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =