title: How to count the number of elements in all Oracle varrays from table?
body: <p>I have a table like this:</p>
  
  <pre><code>CREATE TABLE spatial_data (
    id NUMBER PRIMARY KEY,
    geometry SDO_GEOMETRY);
  </code></pre>
  
  <p>SDO_GEOMETRY has a field sdo_ordinates with the following type:</p>
  
  <p>TYPE SDO_ORDINATE_ARRAY AS VARRAY(1048576) OF NUMBER</p>
  
  <p>I can get the number of points for specified object:</p>
  
  <pre><code>select count(*)
  from table(
      select s.geometry.sdo_ordinates
      from spatial_data s
      where s.id = 12345
  );
  </code></pre>
  
  <p>How can I get count for several objects? It's not possible to use</p>
  
  <pre><code>where s.id in (1, 2, 3, 4, 5)
  </code></pre>
  
  <p>And I really care about performance. Maybe PL/SQL would be the right choice?</p>