Applier thread 1 runs post-apply SQL statements or stored procedures before the main Applier thread commits the data across all of the Applier threads. Consequently, Applier thread 1 can process only the data that was committed during previous apply cycles and the change data that Applier thread 1 applied to the target during the current apply cycle. Applier thread 1 cannot process change data that other Applier threads applied to the target during the current apply cycle.
Some target databases provide mechanisms for reading uncommitted data that was loaded by multiple threads.
For Teradata targets, you can use the LOCK TABLE FOR ACCESS clause to ensure that the post-apply SQL statements or stored procedures process change data that other Applier threads applied to the target during the current apply cycle.
The LOCK TABLE clause is a part of the DML SQL command. It is not a separate statement.
The following SQL statement inserts the total number of records in the tgt_db1.tgt_tab target table and the current timestamp into the tgt_db1.stat table:
LOCK TABLE tgt_db1.tgt_tab FOR ACCESS
INSERT INTO tgt_db1.stat(COUNTER,LOAD_TIME)
SELECT count(*), current_timestamp(0) from tgt_db1.tgt_tab;
The total number of records includes the change data that was loaded to this table by all of the Applier threads during the current apply cycle even though this data is not committed yet.