开发者

Oracle timestamp difference greater than X hours/days/months

I am trying to write a query to run on Oracle database. The table ActionTable contains actionStartTime and actionEndTime columns. I need to find out which action took longer than 1 hour to complete.

actionStartTime and actionEndTime are of timestamp type

I have a query which gives me the time taken for each ac开发者_如何学运维tion:

select (actionEndTime - actionStartTime) actionDuration from ActionTable

What would be my where clause that would return only actions that took longer than 1 hour to finish?


Subtracting two timestamps returns an interval. So you'd want something like

SELECT (actionEndTime - actionStartTime) actionDuration
  FROM ActionTable
 WHERE actionEndTime - actionStartTime > interval '1' hour
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜