title: Define Group based on data in a column oracle
body: <p>I have a table with a oracle sequence in col 1 and I need to make groups based on values in col 2.
  Below is sample table with data. DB version = Oracle 12.1</p>
  
  <blockquote>
    <p>The condition for grouping is either col2 should have 50  or if it has
    30 then next 50 should fall in the same group. There cannot be 30 alone.It will be followed by 50</p>
  </blockquote>
  
  <p>I wrote the below,but not getting the expected outcome</p>
  
  <pre><code>SELECT col1,col2,count(CASE WHEN col2 in (30,50) THEN 1 END)OVER(ORDER BY col1) from table.
  </code></pre>
  
  <p>At the end I need the highest group, that will be doable.</p>
  
  <pre><code>Col1  Col2   Expected output Grp
  ----- -----  -------------------
  1      3
  2      50        1
  3      10
  4      2
  5      30        2
  6      12
  7      50        2
  8      14
  9      50        3
  10     50        4
  </code></pre>