[Oracle]update A.column = B.column

因為MSSQL與ORACLE的語法稍有不同,寫了兩個範例記錄差異。

MSSQL:

UPDATE AAA 
SET AAA.name = BBB.name 
FROM AAA, CCC, DDD, BBB, EEE 
WHERE 1=1 
AND AAA.nid = CCC.id 
AND EEE.id = CCC.cid 
AND DDD.cid = EEE.id 
AND DDD.kid = BBB.id

ORACLE:

UPDATE AAA P1 
SET (P1.NAME) = 
( 
  SELECT BBB.NAME 
  FROM AAA P2, CCC, DDD, BBB, EEE 
  WHERE 1=1 
  AND P2.NID = CCC.ID 
  AND EEE.ID = CCC.CID 
  AND DDD.CID = EEE.ID 
  AND DDD.KID = BBB.ID 
  AND P1.ID = P2.ID 
);