Hi,
I am new to DB2, I have a script that is working on DB2 v9.8 but not in DB2 v9.5:
BEGIN
IF NOT EXISTS (SELECT TABNAME FROM SYSCAT.TABLES WHERE TABNAME='TABLE1')
THEN
EXECUTE IMMEDIATE
'CREATE TABLE "TABLE1" (
"USERNAME" VARCHAR (130) NOT NULL,
"PASSWORD" VARCHAR (1020),
PRIMARY KEY(USERNAME))';
END IF;
END@
I tried using BEGIN ATOMIC, it still doesnt work.
My idea is: I want to check 1st if the table exist then create table if it doesnt. is it possible to do this w/o doing a procedure/function?
Any suggestion(s)/idea? Thanks in advance!
I am new to DB2, I have a script that is working on DB2 v9.8 but not in DB2 v9.5:
BEGIN
IF NOT EXISTS (SELECT TABNAME FROM SYSCAT.TABLES WHERE TABNAME='TABLE1')
THEN
EXECUTE IMMEDIATE
'CREATE TABLE "TABLE1" (
"USERNAME" VARCHAR (130) NOT NULL,
"PASSWORD" VARCHAR (1020),
PRIMARY KEY(USERNAME))';
END IF;
END@
I tried using BEGIN ATOMIC, it still doesnt work.
My idea is: I want to check 1st if the table exist then create table if it doesnt. is it possible to do this w/o doing a procedure/function?
Any suggestion(s)/idea? Thanks in advance!