title: difference between two timestamps (in days) in oracle
body: <pre><code>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
  </code></pre>
  
  <p>I would like the last columns output to be 7 (for the days). I have tried  trunc and extract like some other posts mentioned but can't seem to get the syntax right.  Any ideas?</p>