I currently wish to write a query to duplicate data in database while modifying one column.
First of all, my database structure:
CURCD NOT NULL VARCHAR2(3) CODE NOT NULL VARCHAR2(2) ITEM NUMBER(1) DSCPT VARCHAR2(20)
The unique idx is the curcd,code,item.
What I wish to achieve is duplicate data of code '80' with a set of code = '82'
So, my query will be
insert into code (CURCD,CODE,ITEM,DSCPT) select CURCD,'82',ITEM,DSCPT from code where code = '80';
this is working. Then I planned to create for code = '83', but due to there is already having existing data in the table for code 83, can anyone giving advises on how to modify the script? The existing data is having curcd = 'MYR' and item is in (3,5)
I had tried the
not exist without success.