Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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 :: mysql view 
Sql :: sequelize postgresql schema 
Sql :: postgres add foreign key to existing table 
Sql :: postgresql cast string to int 
Sql :: sql query to linq converter online 
Sql :: how to create notes in mysql 
Sql :: ring MySQL commit updates to the database 
Sql :: install mysql ubuntu 20.10 
Sql :: are both the inserted and deleted tables used in update trigger 
Sql :: in subquery terminology, the first query in the sql statement is known as the _____ query. 
Sql :: app times 
Sql :: sqlalchemy datetime utcnow 
Sql :: sql on-premises 
Sql :: mysql command line top 10 
Sql :: sql developer sql worksheet not showing 
Sql :: SQL ANY and ALL Operators 
Sql :: influxdb clone measurement 
Sql :: como leer datos de mysql esp32 
Sql :: <connectionStrings <add name="MainDB" connectionString="Data Source=multidc02.its.com.pk,47328;Initial Catalog=ITSGeneralApplications;User ID=ITSGeneralAdmin;Password=TDsHn6TTyJohXCe"/ </connectionStrings 
Sql :: sqlite update where exists 
Sql :: how to get employee having maximum experience in mysql 
Sql :: query to fetch 50% records from the table. 
Sql :: sql xampp gabungan nama awal dan akhir 
Sql :: SQL RIGHT JOIN With AS Alias 
Sql :: debian 10 install postgresql 2ndquadrant 
Sql :: c# select mssql 
Sql :: Join base on multiple or conditions 
Sql :: how get data from database if id not found then search another column 
Sql :: ltrim in sql 
Sql :: Resulting Query 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =