我正在尝试创建一个存储过程,它将运行从临时表到主表的合并,但是,当我尝试创建时,我收到此错误:
DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=END-OF-STATEMENT;.LAST_CHANGED_DATE
);<psm_semicolon>, DRIVER=3.69.24 [SQL State=42601, DB Errorcode=-104]
任何帮助将不胜感激
CREATE PROCEDURE sp_UpdateM25
LANGUAGE SQL
BEGIN
MERGE INTO MEDILOAD.M25 M25
USING ( SELECT NDC_UPC_HR1,
ID_NUM_FORMAT,
REC_CODE,
TRAN_CODE,
OVERLOADED_AREA,
LAST_CHANGED_DATE
FROM MEDILOAD.M25_STAGE) M25_STAGE
on (M25.NDC_UPC_HR1 = M25_STAGE.NDC_UPC_HR1 and M25.REC_CODE = M25_STAGE.REC_CODE)
WHEN matched then
update set
M25.NDC_UPC_HR1 = M25_STAGE.NDC_UPC_HR1,
M25.ID_NUM_FORMAT = M25_STAGE.ID_NUM_FORMAT,
M25.REC_CODE = M25_STAGE.REC_CODE,
M25.TRAN_CODE = M25_STAGE.TRAN_CODE,
M25.OVERLOADED_AREA = M25_STAGE.OVERLOADED_AREA,
M25.LAST_CHANGED_DATE = M25_STAGE.LAST_CHANGED_DATE
WHEN NOT MATCHED then
INSERT
(
M25.NDC_UPC_HR1,
M25.ID_NUM_FORMAT,
M25.REC_CODE,
M25.TRAN_CODE,
M25.OVERLOADED_AREA,
M25.LAST_CHANGED_DATE
)
VALUES
(
M25_STAGE.NDC_UPC_HR1,
M25_STAGE.ID_NUM_FORMAT,
M25_STAGE.REC_CODE,
M25_STAGE.TRAN_CODE,
M25_STAGE.OVERLOADED_AREA,
M25_STAGE.LAST_CHANGED_DATE
);
END
@