select f."_File-Number"
from pub.”_File” f inner join pub."_CDC-Table-Policy" tp on f.rowid = tp.”_Source-File-Recid” and tp."_Policy-Instance" = 0 -- Policy is current. where f."_file-name" = ‘customer’ |
select my_searched_col, _Operation
ID_f1, ID_f2, ID_f3 from pub."_Cdc-Change-Tracking" ct inner join pub.CDC_Customer c -- well-known Change table name. on ct."_Change-Sequence" = c."_Change-Sequence" where ct."_ Source-Table-Number" = ? -- from 1st query. and c."_Operation" != 3 -- optional - exclude Before Update images. and ((c."_Operation" = 4 and is_column_changed(pub.CDC_Customer,my_searched_col,_Change-FieldMap) = 1) or c."_Operation" in (1, 2) ) order by ct."_ Source-Table-Number", ct."_Change-Sequence"; -- Order By keys map to index _Sequence-Id |
do
query #2 -- this is query above, in Step #2. exitloop if no data Let RS = result set from query #1 Let stmt = switch _Operation case Create – Build Insert stmt for fields 1..12, plus Identifying fields, with values from parameters Set parameter values for Insert from RS data case Delete – Build Delete stmt with Identifying fields = parameters Set parameter values from RS ID_f* fields case Update – Build partial Update for DW table for each field f in gcc: -- changed columns Build set f = parameter, remember parameter Build Where clause for ID_F* fields = parameters Set parameter values for “set” from RS data Set parameter values from RS ID_f* fields end switch exec sql Prepare of generate stmt -- set all parameters for generated stmt switch _Operation case Create – Set parameter values for Insert from RS data case Delete – Set parameter values from RS ID_f* fields case Update – Set parameter values for “set” from RS data Set parameter values from RS ID_f* fields end switch -- Now execute prepared stmt to send changes to DW execute generated stmt enddo |