how to update data using different table
have posted the same question to public
Status:
Open Jul 05, 2010 - 01:20 AM
table, oracle, oraclesql
2answers
Answers
Jul 16, 2010 - 08:26 AM
Hi MURIUK14,
I think you are reposting this question, here is the solution.
Use this to get the correct data fill in from table A to table B.
this takes care of the exsisting but incorrect records by updating those rows with values from table A and the non-exsisting records in table B by inserting those rows from table A.
MERGE INTO B
USING A
ON (B.id = A.id)
WHEN MATCHED THEN
UPDATE
SET B_col1 = A_col1,
B_col2 = A_col2,
B_col3 = A_col3,
B_col4 = A_col4
WHEN NOT MATCHED THEN
INSERT (B_col1,B_col2,B_col3,B_col4)
VALUES (A_col1,A_col2,A_col3,A_col4);
Mar 31, 2012 - 10:58 AM
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.
The Quomon Team
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment