Using st_geomfromwkb in PL/SQL

382
2
07-17-2017 08:17 AM
Highlighted
New Contributor II

Hello,

I'm trying to do some tests on a big table of sdo_geometries.

For that purpose I want to "translate" the oracle sdo_geometries to sde.st_geometry.

In pure SQL I can simply do that like this:

 ... sde.st_geomfromwkb(sdo_util.to_wkbgeometry(a.SHAPE), 25832) ...

In my PL/SQL function I tried it this way:

DECLARE

   sdegeom sde.ST_GEOMETRY;

...

sdegeom :=  SDE.ST_GEOMETRY_OPERATORS.st_geomfromwkb(sdo_util.to_wkbgeometry(rec.SHAPE), 25832);

But I get this error:

PLS-00224: Objekt 'SDE.ST_GEOMETRY_OPERATORS.ST_GEOMFROMWKB' muss für diese Verwendungsart Type-Funktion oder Array sein

I'm not really famliliar with PL/SQL, so any advice would be nice!

Is there a better way to translate from sdo_geom to st_geometry?

Greetings!!

Reply
0 Kudos
2 Replies
Highlighted
Occasional Contributor II
Reply
0 Kudos
Highlighted
New Contributor II

Hello Alex,

thanks for your answer.

In this example the "st_geomfromwkb" function is used within a SQL statement.

What I want to do, is use it to populate a variable in an pl/sql statement.

Luckily I found a solution:

As odd as it sounds, the trick is to append an "_f" to the function name.

DECLARE

   sdegeom sde.ST_GEOMETRY;

...

sdegeom :=  SDE.ST_GEOMETRY_OPERATORS.st_geomfromwkb_f(sdo_util.to_wkbgeometry(rec.SHAPE), 25832);

I don't really understand why this is necessary. But hey: it works...

Greetings!!