Discussion:
Identify records modified based on time
(too old to reply)
g***@vsnl.net
2007-09-25 04:15:57 UTC
Permalink
I have a small requirement where by I want to retrieve all the records in a table modified since last 24 hours. Can anyone please help me out with this query?

Is this possible?

TIA.
Knut Stolze
2007-09-25 08:52:43 UTC
Permalink
Post by g***@vsnl.net
I have a small requirement where by I want to retrieve all the records in
a table modified since last 24 hours. Can anyone please help me out with
this query?
You have to add a column to the table which stores the time of the last
modification. The values in that column can be maintained by triggers.
Then you can query the table and filter based on that column.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Blair Kenneth Adamache
2007-09-25 20:50:52 UTC
Permalink
You would need to add a column that contains the timestamp of the last
UPDATE, and then create a TRIGGER on UPDATE to put in the current
timestamp. You could then select the rows that have a timestamp within
the last 24 hours.

You could do the same thing with a TRIGGER on INSERT to capture any rows
inserted in the last 24 hours.
Post by g***@vsnl.net
I have a small requirement where by I want to retrieve all the records in a table modified since last 24 hours. Can anyone please help me out with this query?
Is this possible?
TIA.
Loading...