title: Oracle 11g: Extracting and Counting XML elements
body: <p>I have XML type data stored in an Oracle 11g database. A sketchy version of my data would look like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;record&gt;
  &lt;record_number&gt;12345&lt;/record_number&gt;
  &lt;record_type&gt; book &lt;/record_type&gt;
  &lt;/record&gt;
  </code></pre>
  
  <p>Data manipulation functions such as:</p>
  
  <pre><code>SELECT XML_Type FROM Metadata
  </code></pre>
  
  <p>specify the column where each row contains a well-formatted XML file (with many tags and elements). I am struggling to extract and count the number of occurrences for each <code>&lt;record_type&gt;</code> element. For instance, I would like to know how many times the XML tag <code>&lt;record_type&gt;</code> has the element 'book', 'article', etc. I do not know the entire list of elements associated to the tag , though.  </p>
  
  <p>Thanks,</p>
  
  <p>I.</p>