title: loop through set of values, compare and increase count
body: <p>I have a set of values in the types column</p>
  
  <pre><code>types
  ABC
  EVAL
  IBC
  ABC
  IBC
  IBC
  EVAL
  </code></pre>
  
  <p>I want to loop  from first row and compare with the next value, each time the values are different I want to increase the count. For Example if I compare first value with second ABC = EVAL as they are diff I want to increase the count. In the next round I will compare value 2nd row with value from 3rd row i.e EVAL=IBC and again as they are diff I want to increase the count.</p>
  
  <p>I tried using cursor but I am not able to get the next column value in the cursor.</p>