Use the SDO_UTIL.FROM_WKTGEOMETRY() in Oracle

260 views Asked by At

I am aware that we can use Oracle in-built functions in "SDO_UTIL" to convert SDO_GEOMETRY format to JSON and vice versa. This time, I want to convert the data in my table which is in WKT geometry format to SDO_GEOMETRY. But when I tried it, I get errors such as ORA-00907: missing right parenthesis.

In the docs, I read about SDO_UTIL.FROM_WKTGEOMETRY.

I have shared a very simple example below where I get the error:

SELECT SDO_UTIL.FROM_WKTGEOMETRY(
POINT (10.0 5.1)
)
FROM dual
;

It gives me the ORA-00907: missing right parenthesis error. I tried adding '' quotation marks, () parenthesis, but to no avail.

Surprisingly, the reverse function to convert SDO_GEOMETRY to WKT geometry works well. Example given below:

SELECT SDO_UTIL.TO_WKTGEOMETRY(
SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(10, 5.1, NULL), NULL, NULL)
)
FROM dual
;

It ran successfully and I got the output in WKT geometry as POINT (10.0 5.1)

So I am wondering what am I missing in SDO_UTIL.FROM_WKTGEOMETRY.

0

There are 0 answers