cancel
Showing results for 
Search instead for 
Did you mean: 

SA17 ERROR handling Spatial SRID in stored PROCEDURE

1,753

I'm getting an error reading spatial data using a stored procedure.

First create some data:

CREATE OR REPLACE TABLE "DBA"."TEST" (
    "ID" INTEGER,
    "FEATURE_GEOMETRY" ST_Geometry(SRID=3857) NULL,
    PRIMARY KEY ( "ID" ASC )
) IN "system";
INSERT INTO "DBA"."TEST" ("ID","FEATURE_GEOMETRY") VALUES(1,'Point (-79.3832 43.6682)');

Then try to retrieve it via a stored procedure:

CREATE OR REPLACE PROCEDURE TEST()
BEGIN
    SELECT * FROM TEST;
END;
SELECT * FROM TEST();

This produces the error: Transform from SRID 3857 to 2147483647 not supported.

However, it works if I add the following RESULT clause to the procedure:

CREATE OR REPLACE PROCEDURE TEST()
RESULT (ID INTEGER, FEATURE_GEOMETRY TEST.FEATURE_GEOMETRY%TYPE )
BEGIN
    SELECT * FROM TEST;
END;
SELECT * FROM TEST();

I would have expected the implied RESULT would use the data types from the base table.

I'm running SQL Anywhere is 17.0.0.1358.

Accepted Solutions (0)

Answers (0)