Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
there are two tables one is COPYCLAIMPRGNOTE and another one is COPYCLAIMPRGNOTE1, COPYCLAIMPRGNOTE contain only 2 columns one is claim_id and another one is NOTE_MEMO_CARETECH. and other table have many columns but NOTE_MEMO_CARETECH column is missing. I want to create NOTE_MEMO_CARETECH column in COPYCLAIMPRGNOTE1 with all the values which is in another table COPYCLAIMPRGNOTE.

please how to do that I am new in oracle so I don't know how to do it/

What I have tried:

SQL
INSERT INTO COPYCLAIMPRGNOTE1 (CLAIM_ID,NOTE_MEMO_CARETECH)  
    SELECT DISTINCT COPYCLAIMPRGNOTE1.CLAIM_ID,COPYCLAIMPRGNOTE1.NOTE_MEMO_CARETECH
    FROM COPYCLAIMPRGNOTE src 
    inner JOIN COPYCLAIMPRGNOTE1
    ON (COPYCLAIMPRGNOTE.CLAIM_ID=COPYCLAIMPRGNOTE1.CLAIM_ID)


SQL
insert into 
    COPYCLAIMPRGNOTE1 values (NOTE_MEMO_CARETECH)
INNER JOIN COPYCLAIMPRGNOTE ON
    COPYCLAIMPRGNOTE1.CLAIM_ID = COPYCLAIMPRGNOTE.CLAIM_ID
ORDER BY
    EVENT_ID DESC;


I tried this 2 queries to transfer data but its not working.
Posted
Updated 27-Jun-22 12:51pm
v2

1 solution

Hi,

Insert will add new rows in your new table, it will not update the existing rows.
For this you will have to use update query as below

UPDATE T1 SET NOTE_MEMO_CARETECH=T2.NOTE_MEMO_CARETECH
FROM COPYCLAIMPRGNOTE1  T1
INNER JOIN COPYCLAIMPRGNOTE T2 ON T2.CLAIM_ID=T1.CLAIM_ID
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900