title: Counting the number of occurrences of a character in Oracle SQL
body: <p>How can I count the number of times that a particular character occurs in a column in Oracle?  For example, if I have a table <code>FOO</code> that has data like <code>a,ABC,def</code> and <code>2,3,4,5</code>, I want to count the number of times that a comma appears in the data.</p>
  
  <pre><code>CREATE TABLE foo (
    str varchar2(30)
  );
  
  INSERT INTO foo VALUES( 'a,ABC,def' );
  INSERT INTO foo VALUES( '2,3,4,5' );
  commit;
  </code></pre>
  
  <p>The output that I want is</p>
  
  <pre><code>str         cnt
  a,ABC,def   2
  2,3,4,5     3
  </code></pre>