SELECT MIN (snap_id) AS FIRST_SNAP,
MAX (snap_id) AS LAST_SNAP,
MIN (BEGIN_INTERVAL_TIME) AS FIRST_QUERY,
MAX (END_INTERVAL_TIME) AS LAST_QUERY,
max(end_interval_time) - min(begin_interval_time) as "TIME_ELAPSED"
FROM dba_hist_snapshot
ORDER BY snap_id;
2931 3103 5/28/2012 6:00:11.065 AM 6/4/2012 11:00:40.967 AM +07 05:00:29.902000
我希望最后一列输出为 7(对于这些天)。我已经尝试过 trunc 和 extract 就像提到的其他一些帖子一样,但似乎无法正确使用语法。有任何想法吗?