Reflecting a Physical Delete as a Logical Delete in the Target with ODI CDC+SCD
When a physical delete is performed on a table that we have added to Change Data Capture (CDC) in the source, it lands in the Journal table with JRN_FLAG = ‘D’. However, if you use the IKM Oracle Incremental Update module, this is reflected in the target as a physical delete, and if you use the IKM Oracle Slowly Changing Dimension module, you will see that the records deleted in the source do not affect the target. In this regard, you will find the following (and actually correct) explanation in the Description section of the SCD module.
– As this Knowledge Module is dedicated to Datawarehouse Projects (where data should not be removed), when using it with a journalized Source Datastore, it is not possible to synchronize deletions. Therefore, data should be manually filtered to exclude any source delete events (add a filter on JRN_FLAG = ‘I’).
However, in some cases we may need to see a physical delete that occurred in the source as a logical delete in the target. Requirements vary, but at the very least the ENDING TIMESTAMP column may need to be updated to indicate that the record’s lifetime has ended, and the CURRENT RECORD FLAG column to indicate that it is no longer active. (The reason for this post is a request along these lines from a valued customer…) For example;

I searched the internet to find out what to do in this case, but could not find any content specifically about it. Later, when I examined the KM code, I saw that there was actually a simple solution. (This may be why I couldn’t find a solution online 🙂 )
Solution :
If you examine the “Historize old rows” step in the IKM Oracle SCD module, you will see that the module already updates the ENDING TIMESTAMP and CURRENT RECORD FLAG columns that we want to update, but that, by design, it uses the condition IND_UPDATE = ‘I’ (only newly inserted and updated rows; yes, updates also arrive in the Journal table with the “I” flag) in two places in order to exclude deleted records. All we need to do is include the deleted records in the Historize step as well, and the change below is enough for that.
IKM Oracle Slowly Changing Dimension module – “312 Historize Old Rows” script, original state :

Version modified to suit our needs :

While historizing the old version of updated rows, this change also updates the Current Record Flag = 0 and Ending Timestamp = (TXN_TIME or SYSDATE) fields of the rows corresponding to deleted records. This solution was prepared for SCD; you can modify the Incremental Update module with a similar approach. Good luck.
