How to load every 5th record into target table
We need to read the source table and load only 1st and every 5th (nth) records to target.
Let’s start the mapping for this. We need a sequence generator and a filter transformations to complete this requirement. The logic which we are following here is to assign sequence numbers from 1 t0 5 to source records using Sequence transformation and then Using a filter transformation to filter out all records other than first & 5th records.
Source – EMPLOYEES (Oracle Table)
Target – EMPLOYEES_TGT (Oracle Table)
Sequence Generator – Assign sequence numbers from 1 to 5 using start, end value & cycle options.
Filter – To process only First & 5th record by filtering out all other records.
Start Value – 1
Increment by – 1
End Value – 5
Current Value – 0
Enable ‘Cycle‘ & ‘Reset‘ Option
NEXTVAL = 5 (Every Fifth Record)
NEXTVAL = 0 (First Record)
IIF(NEXTVAL=5 OR NEXTVAL=0,TRUE)