IBM DB2 Timetravel logging based on some criteria

95 Views Asked by At

I have been searching for the condition, where, lets say when we enable time travel to a certain table in DB2 , but don't want to capture all the updates done, but only the updates that's done by some specific user.

Wanted to know if this is at all possible with the DB2 time travel and how we can achieve it .

2

There are 2 best solutions below

2
On

It's not possible with DB2 temporal tables.

0
On

Alter the temporal table add a user column maintained by system. db2 for Iseries column shown

EMP_CHANGE_USER VARCHAR(18) GENERATED ALWAYS AS (USER)

The new column will go automatically to the history table of the temporal table. You can report on the history table and have emp_change user.

Note: IRL Don't single out users. You can give management a report that lists out all users and management can filter it down to individuals. Programmers do not single out users for reporting and logging.