我如何使用Merge语句将数据从一个表合并到另一个表。
MERGE INTO TESTDTA.F4311 B
USING (SELECT PDDOCO,PDDCTO,PDKCOO,PDSFXO,PDLNID,PDAMC3 FROM F4311_0226A) S
ON (B.PDDOCO=S.PDDOCO,b.pddcto=s.pddcto,b.pdkcoo=s.pdkcoo,b.pdsfxo=s.pdsfxo,b.pdlnid=s.pdlnid)
WHEN MATCHED THEN
update set b.pdamc3=s.pdamc3
但此语句的错误如下
SQL错误:ORA-00907:缺少右括号00907. 00000-"缺少右括号"*原因:
*行动:
on
子句应使用and
,而不是,
:
ON (B.PDDOCO = S.PDDOCO and b.pddcto = s.pddcto and b.pdkcoo = s.pdkcoo b.pdsfxo = s.pdsfxo and b.pdlnid = s.pdlnid)