Hi,
I have a table with 2 columns
** CREATE TABLE test (emp_num DECIMAL(7) NOT NULL,emp_name CHAR(10) NOT
NULL) and i have inserted a number of records.
** Now, I want to insert a new record (3232,'Raindeer ') based on the
condition that the
emp_num 3232 doesnt exist.
SELECT * ,
CASE
when not exists (SELECT * from test where emp_num=3232)
then insert into test values (3232,'Raindeer ')
END
FROM test";
** I get the following error ::
SQL0104N An unexpected token "*" was found following "SELECT ".
Expected tokens may include: "?
** Can anyone help me to modify this code. I would appreciate if some
one would
show me the different variations in acheiving the output.
Thanks in advance.
I have a table with 2 columns
** CREATE TABLE test (emp_num DECIMAL(7) NOT NULL,emp_name CHAR(10) NOT
NULL) and i have inserted a number of records.
** Now, I want to insert a new record (3232,'Raindeer ') based on the
condition that the
emp_num 3232 doesnt exist.
SELECT * ,
CASE
when not exists (SELECT * from test where emp_num=3232)
then insert into test values (3232,'Raindeer ')
END
FROM test";
** I get the following error ::
SQL0104N An unexpected token "*" was found following "SELECT ".
Expected tokens may include: "?
** Can anyone help me to modify this code. I would appreciate if some
one would
show me the different variations in acheiving the output.
Thanks in advance.
Comment