Oracle 11g合并ORA-00905:缺少关键字

时间:2018-02-23 08:55:19

标签: oracle oracle11g sql-merge

我似乎无法找到查询中缺少的内容:

MERGE INTO Account D
   USING (SELECT       1 AS ID 
                 ,'AAAA' AS NAME
                ,'123Z4' AS GUID
                     , 1 AS STATUS 
          FROM DUAL
         ) S
   ON (D.GUID  = S.GUID)
   AND (D.Name = S.Name)
   WHEN MATCHED 
   THEN 
   UPDATE SET D.Status = S.Status 
   WHEN NOT MATCHED 
   THEN 
   INSERT (D.Id, D.Name, D.GUID, D.Status)
   VALUES (1 , 'AAAA' , '123Z4' , 1)

它给我一个错误的ORA-00905:缺少关键字。

1 个答案:

答案 0 :(得分:0)

目标表和源查询之间的连接条件需要是一对括号内的“单个”条件:

ON (D.GUID  = S.GUID AND D.Name = S.Name)