troubleshooting Question

compare timestamps in db2 in java

Avatar of lilyyan
lilyyan asked on
5 Comments2 Solutions755 ViewsLast Modified:
hello every1,

in my table, there is a column called submittime, the value for this column is the current time when the row was created.

my questions is, after certain time, say one year, i want to check those rows in the table. if some rows haven't been updated by user for one year since last time updating, i want to make this row inactive .

my question is:

should i compare the value of submittime with the current time in a sql query in java, something like:
select user_id from mymembertable where current timestamp - submittime < 1 year;

or i should select user_id and  submittime from the table first, then taransfer  submittime  
to milliseconds, then compare it with current time also in java

looks like the first way is more simpler?

thanks so much for your reply,

Mick Barry
Java Developer
Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros