We’d like to set the IS_DEL bit = 1 when a record exists in a Target table that doesn’t exist in the Source table.
Is it possible to use a MERGE statement using the WHEN NOT MATCHED clause, but make it perform an UPDATE?
When attempting to do so, I’m getting a “ORA-00905: missing keyword” message.
MERGE INTO AMEPSA.ENTERPRISE_LOCATION trg USING ( SELECT C.LOCATION_KEY as LOCATION_KEY FROM AMEPSA.ENTERPRISE_LOCATION C INNER JOIN AMESTAGE.VW_LOCATION L ON C.REC_SRC_KEY_CD = L.LOCATION_ID WHERE C.CURR_REC_IND = 'Y' ) src ON (trg.LOCATION_KEY = src.LOCATION_KEY) WHEN NOT MATCHED THEN UPDATE SET trg.IS_DEL = 1
Does the “WHEN NOT MATCH” clause only support “THEN INSERT”?
Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.