function to get x, y
don123Dec 14 2012 — edited Dec 17 2012hi, can you help me to write the function. The function should take table name, geometry column as input and should give id, x coordinate, y coordinate as output. I have tried with the following. The error is below.
========================================================
SQL> show errors
Errors for FUNCTION GETXY:
LINE/COL ERROR
-------- --------------------------------------------
13/10 PLS-00103: Encountered the symbol "," when e
following:
. ( * @ % & = - + ; < / > at in is mod remai
<an exponent (**)> <> or != or ~= >= <= <> a
like4 likec between || multiset member submu
14/1 PLS-00103: Encountered the symbol "CLOSE"
==============================================================
create or replace function getxy
(name in varchar2, geom in mdsys.sdo_geometry, id out number, x out number, y out number)
return number
IS
n1 number;
n2 number;
n3 number;
cursor c1 is select a.idnumber, t.x, t.y from name a, table(sdo_util.getvertices(a.geometry)) t;
begin
open c1;
fetch c1 into n1, n2, n3;
exit when c1%notfound;
return n1, n2, n3;
close c1;
end getxy;