I have table with columns : xx_org
Org_name source_id source_owner
and another table with : master_org
name, source_id,source_owner, class
now i have to update all the source_ids in master_org with source_id in xx_org for whatever org name is there in xx_org and master_org which is common. for uncommon ones nothing should be done.
I used :
    update HR.master_org T1,XX_ORG T2 
set  T1.SOURCE_ID=T2.SOURCE_ID
    WHERE t2.ORG_NAME = t1.name ;
But this is giving an error :
Error report:
SQL Error: ORA-00971: missing SET keyword
00971. 00000 -  "missing SET keyword"
*Cause:    
*Action:
Looking at other posts given i also tried :
UPDATE 
(select TABLE1.SOURCE_ID as old, TABLE2.SOURCE_ID as new
 from XX_ORG TABLE1
 INNER JOIN HR.master_org  table2
 ON table1.ORG_NAME = table2.name
) T
SET t.old = t.new
I got :
Error report:
SQL Error: ORA-01779: cannot modify a column which maps to a non key-preserved table
01779. 00000 -  "cannot modify a column which maps to a non key-preserved table"
*Cause:    An attempt was made to insert or update columns of a join view which
           map to a non-key-preserved table.
*Action:   Modify the underlying base tables directly.
As suggested in Update statement with inner join on Oracle
I tried using merge because other queries didnt work but even after showing 1400 rows merged i cannot see my rows updated. I am using :
merge
INTO    hr.master_org trg
using   (
        SELECT  t1.rowid AS rid, t2.SOURCE_ID,t2.SOURCE_owner
        FROM    hr.master_org t1
        join    XX_ORG T2
        on      T1.ORGANIZATION_NAME = t2.ORG_NAME
        where   T1.ORGANIZATION_NAME = T2.ORG_NAME
       -- and t1.ORGANIZATION_NAME='TMI Operations, M1'
        ) src
ON      (trg.rowid = src.rid)
when matched then update
    set TRG.SOURCE_id = SOURCE_id,
    TRG.SOURCE_owner = SOURCE_owner;
sample data :
XX_ORG
source_id source_owner  org_name
EB73636   EBS           TMI
MASTER_ORG
source_id      source_owner  org_name
EB7363-30-JAN   FUSION         TMI
I want to update master_org in such a way that
   source_id      source_owner  org_name
    EB73636        EBS            TMI
 
    