title: Oracle DB - count non-consecutive actions
body: <p>Hi I have the scenario where the SQL in oracle db, should return the count of the shown variables value as below.</p>
  
  <p>Action field will have Insert and Delete as a value for different time stamp but when I report the count it should be like for the given input.</p>
  
  <p><a href="https://i.stack.imgur.com/8PYUC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8PYUC.png" alt="enter image description here"></a></p>
  
  <p>The logic is all the <code>Insert</code> or all the <code>Delete</code> should be counted as <code>1</code> till it hits <code>delete</code> or <code>Insert</code> respectively.  </p>
  
  <p>Like a call center a customer can add any number of compliant (Insert) but that should be counted as 1 for that user id, if the already registered complaint is resolved (Delete) then next sequence of complaint (Insert) should be counted as one. </p>
  
  <p>Any help is highly appreciated and Many thanks in advance!</p>
  
  <p>Deva</p>