I am very new to oracle spatial.
I have a spatial table with one SDO_GEOMETRY column. After inserting POINT data in this table, I want to retrieve data in WKT format.
Here is what I did:
Inserting data -
INSERT INTO new_test (name, geom) VALUES (
'Test',
SDO_GEOMETRY(
2001,
4326,
SDO_POINT_TYPE(12,14,NULL),
NULL,
NULL));
Fetching data -
SELECT NAME, SDO_UTIL.TO_WKTGEOMETRY(GEOM) AS point FROM NEW_TEST;
Output -
NAME | POINT
-------------
Test | (null)
Why do I get null here? Shouldn't it display the co-ordinate points?
Too long for a comment - not sure why it doesn't work for you but I cannot replicate your results:
Oracle Setup:
CREATE TABLE new_test ( name varchar2(20), geom SDO_GEOMETRY );
INSERT INTO new_test (name, geom)
VALUES (
'Test',
SDO_GEOMETRY( 2001, 4326, SDO_POINT_TYPE(12,14,NULL), NULL, NULL)
);
Query:
SELECT NAME, SDO_UTIL.TO_WKTGEOMETRY(GEOM) AS point FROM NEW_TEST;
Output:
NAME POINT
---- -----------------
Test POINT (12.0 14.0)