title: find group by clause error programmatically
body: <p>We are going to update our database from 10g to 12c. Before doing so we need to revisit our SQLs, and as a part of this we need to check the following behavior of <code>GROUP BY</code></p>
  
  <p><strong>case 1:</strong></p>
  
  <pre><code>SELECT abcd_pk,
    COUNT(abcd_code),
    ABCD_COUNT
  FROM
    (SELECT abcd_pk,
      abcd_code,
      (SELECT COUNT(abcd_code) FROM ABCD_TABLE
      ) "ABCD_COUNT"
    FROM ABCD_TABLE
    )
  GROUP BY abcd_pk, ABCD_COUNT ;
  </code></pre>
  
  <ol>
  <li>WORKS IN 10G</li>
  <li>WORKS IN 12C</li>
  </ol>
  
  <p><strong>case 2:</strong></p>
  
  <pre><code>SELECT abcd_pk,
    COUNT(abcd_code),
    ABCD_COUNT
  FROM
    (SELECT abcd_pk,
      abcd_code,
      (SELECT COUNT(abcd_code) FROM ABCD_TABLE
      ) "ABCD_COUNT"
    FROM ABCD_TABLE
    )
  GROUP BY abcd_pk ;
  </code></pre>
  
  <ol>
  <li>WORKS IN 10G</li>
  <li>DOES NOT WORK IN 12C (ORA-00979: not a GROUP BY expression 00979. 00000 -  "not a GROUP BY expression")</li>
  </ol>
  
  <p>Our code may contains case2 like SQL which is not appropriate. So we need to identify those SQLs. I already prepared a list of SQLs contains <code>GROUP BY</code> used in our project (.java files/procedure/function/views etc.).</p>
  
  <p>Requirement is find the problem in <code>GROUP BY</code> using the following process:</p>
  
  <ol>
  <li>Check the SQLs in the list one by one.</li>
  <li>Find an alternate way to check the list of SQLs programmatically.</li>
  </ol>
  
  <p>Option 1 requires massive work load, effort and time, but I think option 2 is not possible.</p>
  
  <p>Is there any suggestion how to proceed?</p>