我有个疑问
INSERT INTO FCC_CS_WL_SOURCE_REQUEST_ID_MAP
(
"N_WL_SOURCE_REQUEST_ID",
"V_SOURCE_REQUEST_ID",
"V_TARGET_KEY",
"V_TARGET_INDEXNAME"
)
SELECT
MAP_SEQ_TEST.nextval,
FCC_CUST_DIM.V_ALT_CUST_ID AS "V_SOURCE_REQUEST_ID",
FCC_CS_MATCHED_RESULT_BULK.V_TARGET_KEY ,
FCC_CS_MATCHED_RESULT_BULK.V_TARGET_INDEXNAME
FROM FCC_CS_MATCHED_RESULT_BULK INNER JOIN FCC_CUST_DIM
ON FCC_CS_MATCHED_RESULT_BULK.V_SOURCE_KEY =FCC_CUST_DIM.V_CUST_INTRL_ID
AND FCC_CUST_DIM.F_LRI_FL ='Y'
AND FCC_CUST_DIM.V_ALT_CUST_ID IS NOT NULL
AND FCC_CS_MATCHED_RESULT_BULK.N_RUN_SKEY =290
在这里,如果V_SOURCE_REQUEST_ID、V_TARGET_KEY、V_TARGET_INDEXNAME列值已经可用,并且与将要插入的值相同,我需要阻止向FCC_CS_WL_SOURCE_REQUEST_ID_MAP表中插入
如何修改此查询以实现此目的?
2条答案
按热度按时间ve7v8dk21#
使用
MERGE
陈述式:ego6inou2#
在SELECT中添加
NOT EXISTS
子句: