1

I am try create materialized views in Oracle listing a polygon and linestring vertices with their longitude and latitude in separate columns. So I know I would need to count the vertices in each polygon or linesegment but I am not having any luck on either task.

I am trying to get a loop to work to count the vertices in each object but it's not working.

for nn in 1..(nn-1) loop
select OBJECTID, 
SDE.st_x (SDE.st_pointn (sde.st_exteriorring (SHAPE), nn)) as X, 
SDE.st_y (SDE.st_pointn (sde.st_exteriorring (SHAPE), nn)) as Y 
from 
(SELECT sde.st_numpoints (shape) as nn from dual, SDW.trpBridge_test), SDW.trpBridge_test
order by objectid; 
end loop;
  • The nn-1 looks wrong, since it's used to range nn (and also because the loop from 1 should be to count -- it would be from 0 to count-1) – Vince May 6 '16 at 22:49
  • Thank you Vince. Would changing it to 0..nn be enough? for nn in 0..nn loop select OBJECTID, SDE.st_x (SDE.st_pointn (sde.st_exteriorring (SHAPE), nn)) as X, SDE.st_y (SDE.st_pointn (sde.st_exteriorring (SHAPE), nn)) as Y from (SELECT sde.st_numpoints (shape) as nn from dual, SDW.trpBridge_test), SDW.trpBridge_test order by objectid; end loop; – Despina May 9 '16 at 17:18
  • I haven't PL/SQLed, but using a variable the same name as the subselection column looks like your primary issue. The operator is 1-based, so you got both aspects inverted. If you actually edit the question to contain error information, it would be easier for someone too help you. – Vince May 9 '16 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.