I was thinking a trigger also, and if you specify TRGUPDCND(*CHANGE), there'd be no need to compare buffers.
From: rob@xxxxxxxxx [mailto:rob@xxxxxxxxx]
Sent: Wednesday, June 11, 2014 8:26 AM
To: Midrange Systems Technical Discussion
Subject: Re: DB2 Auto-update TimeStamp
Anything's possible given enough time and money.
Instead of something as simple and easy as what you've posted you could always create a trigger that would compare the before and after buffer, and, if they differ, modify the change timestamp in the after buffer.
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
Kendallville, IN 46755
From: Ricky Thompson <rickyt29@xxxxxxxxx>
Date: 06/11/2014 09:11 AM
Subject: DB2 Auto-update TimeStamp
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
I know you can add a timestamp to a table that automatically updates on
insert and update. But can you have it only update if there is a real
change in the data? For example if a update is done to the table but no
data changes I would like for it not to update the timestamp. My guess is
no it's not possible but thought I would ask.
myTimeStamp TIMESTAMP NOT NULL GENERATED BY DEFAULT
FOR EACH ROW ON UPDATE AS
ROW CHANGE TIMESTAMP