cancel
Showing results for 
Search instead for 
Did you mean: 

Hana grid cluster error: cannot use parameter variable

Former Member
0 Kudos

Hello. i am trying to run this SQLScript code inside a stored procedure to get grid clusters from an existing spatial table:

PROCEDURE "DEMO"."SP_1"()
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
READS SQL DATA AS

BEGIN
declare xLeft double = 32.333;
declare xRight double = 37.313;
declare yUp double = 30.723;
declare yDown double = 33.3107;

SELECT ST_ClusterID() as Cluster_ID,
ST_ClusterEnvelope() as CLUSTER_WKT,
COUNT(*) as COUNTER
FROM "DEMO"."Table_1"
GROUP cluster BY "SHAPE"
using grid x between :xLeft AND :xRight cells 20
y between :yDownAND :yUp cells 20;

END;
but execution failed, with the error: "cannot use parameter variable: XLEFT" (error code 467) I have to get this working, because i want dynamically set the grid boundaries for each state, and I can't use EXECUTE/EXECUTE IMMEDIATE to dynamically generate this query, because it's NOT SECURED. I will be glad to receive any kind of help from you. thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor

Please check the restrictions for Spatial Support in HANA SQLScript (HANA Spatial Support).There it is clearly described that functions like ST_CLUSTERENVELOPE are not supported in SQLScript.

Why is it necessary to create a stored procedure for your case? Wouldn't it be enough that the client/service executes the SQL with the arguments you need?

Regards,
Florian