Is it possible to have a loop in SQL without creating a stored procedure? I would like to loop through the vertices in a SHAPE/GEOMETRY column in a user-defined data type (ESRI's version of ST_GEOMETRY). I've posted the details in a GIS SE post here: https://gis.stackexchange.com/questions/209894/update-sde-st-geometry-m-values-to-cumulative-distance-using-oracle-sql

I believe this would normally be done in a stored procedure (probably in conjunction with the sde.ST_GEOMETRY functions ST_NumPoints and ST_PointN) . However, I'm merely a data analyst, not a DBA, and do not have CREATE PROCEDURE permissions, so I can't make a stored procedure. Additionally, in my company/organization, a request for a procedure to be made would either be rejected or take years to be implemented.

So I'm wondering, as an alternative to creating a stored procedure, if I could loop through the vertices within an SQL update statement instead?

Oracle 12c (12.1.0.2.0)
You can put a pl/sql in an anonymous block. Something like this might help:

declare
  v_vertices  your_user_defined_data_type;

  cursor your_cursor_c
  is
    select vertices
    from   your_table
    where  your_column = 'A VALUE';

begin
    open your_cursor_c;
    loop
      fetch your_cursor_c
      into  v_vertices;
      exit when your_cursor_c%notfound;

      ST_NumPoints(v_vertices);
      ST_PointN(v_vertices);

      commit;
    end loop;
end;


Also with 12c there is some inline procedure/function stuff that you can do. Not sure if it is necessary but here is a link: https://oracle-base.com/articles/12c/with-clause-enhancements-12cr1.