Hi all....
Does DB2 UDb uses the clause 'IF EXISTS....ELSE' ????
For eg I want to check whether a record with particular ID exists in the table.If it exists then update the remaining fields else insert a new record.
The below query does not work:
IF EXISTS (SELECT 'X' FROM T1 WHERE ID = 1) UPDATE T1 SET NAME = 'MMM' ELSE INSERT INTO T1 (ID,NAME) VALUES (1,'MMM')
I tried the query UPDATE T1 SET NAME = 'MMM' WHERE EXISTS (SELECT 'X' FROM T1 WHERE ID = 1)....This query works fine but again I want the 'ELSE' part.....
In core...How can I use the update query with conditional exists clause??????
Thanks in advance,
Madhuri.