我的代碼:
創建或替換臨時視圖preprocessed_source
選擇
Key_ID,
Distributor_ID,
Customer_ID,
Customer_Name,
通道
從integr_masterdata.Customer_Master;
步驟2:使用預處理源表執行合並操作
合並成slvr_masterdata。Customer_Master作為目標
使用preprocessed_source作為源
在
源。Key_ID = Target.Key_ID
當匹配
更新設置
目標。Distributor_ID = Source.Distributor_ID,
目標。Customer_ID = Source.Customer_ID,
目標。Customer_Name = Source.Customer_Name,
目標。通道= Source.Channel,
目標。Time_Stamp = current_timestamp ()
當不匹配
然後插入
(
Distributor_ID,
Customer_ID,
Customer_Name,
頻道,
Time_Stamp
)
值(
Source.Distributor_ID,
Source.Customer_ID,
Source.Customer_Name,
Source.Channel,
current_timestamp ()
)