title: Oracle Time Difference over a repeating set
body: <p>I am sure this is an easy problem to solve however I cannot see how no matter which way round I try and look at it.</p>
  
  <p>I am using an Oracle database and I am trying to report on processing times. The system is running a process that picks up incoming files and processes then into the database. As it performs this task it logs when each of the different sections happen and from which source. I've filtered the data to just give me start and end times as that is all I am currently interested in. Example Data</p>
  
  <pre><code>5   15/MAY/15 00:37:01  Started
  5   15/MAY/15 00:50:45  Finished
  5   16/MAY/15 02:07:41  Started
  5   16/MAY/15 02:19:16  Finished
  5   16/MAY/15 23:20:25  Started
  5   16/MAY/15 23:28:53  Finished
  5   17/MAY/15 23:16:36  Started
  5   17/MAY/15 23:27:51  Finished
  5   18/MAY/15 23:31:28  Started
  5   18/MAY/15 23:47:41  Finished
  5   19/MAY/15 23:44:12  Started
  5   20/MAY/15 00:06:17  Finished
  5   20/MAY/15 23:33:42  Started
  5   20/MAY/15 23:58:16  Finished
  </code></pre>
  
  <p>What I am trying to get is the duration for each of the "sets" (Start time to End Time). When there is only a single occurence on a day its easy, however when looking at days such as the 16th where there are two sets in a single day, or where it starts on the 19th and ends on the 20th I am struggling. I know this would be possible within a programming language, however I am sure it must also be possible within Oracle as well.</p>
  
  <p>The output I'd expect form the above is:</p>
  
  <pre><code>Source  StartTime               EndTime
  5       15/MAY/15 00:37:01      15/MAY/15 00:50:45
  5       16/MAY/15 02:07:41      16/MAY/15 02:19:16
  5       16/MAY/15 23:20:25      16/MAY/15 23:28:53
  5       17/MAY/15 23:16:36      17/MAY/15 23:27:51
  5       18/MAY/15 23:31:28      18/MAY/15 23:47:41
  5       19/MAY/15 23:44:12      20/MAY/15 00:06:17
  5       20/MAY/15 23:33:42      20/MAY/15 23:58:16
  </code></pre>
  
  <p>Thanks,</p>