3,494
社区成员




alter table B nologging;
merge into B using A on (A.id=B.id)
when matched then update set B.col1=A.col,B.col12=A.col2....
when not matched then insert(B.id,B.col,B.col2......)
values(A.id,A.col,A.col2......)
update B SET B.name=A.name,B.type=A.type,B.sex=A.sex FROM A where A.ID=B.ID --更新
INSERT INTO B SELECT *FROM A WHERE NOT EXISTs(SELECT 1 FROM B WHERE B.ID=A.ID)--插入