How to count the number of elements in all Oracle varrays from table?

烂漫一生 提交于 2019-12-04 11:06:31

I think that you can do it with one query:

select s.id, count(*)
  from spatial_data s, table(s.geometry.sdo_ordinates)
 group by s.id

or you can write a plsql simple function that returns the count attribute of the SDO_ORDINATE_ARRAY VARRAY:

create or replace function get_count(ar in SDO_ORDINATE_ARRAY) return number is
begin
   return ar.count;
end get_count;

or even nicer add a member function to SDO_GEOMETRY TYPE which return the count attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!