首页 > 代码库 > DB2 的create or update方法

DB2 的create or update方法

通过merge方法实现的:

MERGE INTO IFEBASE.STYLE AS MT
USING (SELECT :scenario AS SCENARIO_ID, :style AS SHAPE FROM SYSIBM.DUAL) AS VT ON (MT.SCENARIO_ID = VT.SCENARIO_ID)
WHEN MATCHED THEN UPDATE SET
MT.SHAPE = VT.SHAPE
WHEN NOT MATCHED THEN
INSERT (SCENARIO_ID, SHAPE) VALUES (VT.SCENARIO_ID, VT.SHAPE)

DB2 的create or update方法