要更新某表,当数据存在时update,不存在时insert,用Merge into
MERGE INTO T_ACTIVITY_INFO TUSING DUAL
ON (T.ACTIVITY_NO = #strActivityNo# AND T.EMP_ID = #strEmpID#)
WHEN MATCHED THEN
UPDATE
SET T.UPT_DATE = SYSDATE,
T.UPT_MAN = #strOrganigerID#
WHERE T.ACTIVITY_NO = #strActivityNo#
AND T.EMP_ID = #strEmpID#
WHEN NOT MATCHED THEN
INSERT
(
T.ACTIVITY_NO,
T.EMP_ID,
T.JOIN_KBN,
T.INS_DATE,
T.INS_MAN,
T.UPT_DATE,
T.UPT_MAN
)
VALUES
(
#strActivityNo#,
#strEmpID#,
'0',
SYSDATE,
#strOrganigerID#,
SYSDATE,
#strOrganigerID#
)