Quantcast
Channel: SCN : Unanswered Discussions - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 4343

Strange error about For - loop with Array?

$
0
0

Dear all,

 

I am trying to write an select in a For - loop . The procedure logic looks like blow.The procedure pass the compile. But when I call the procedure , the error shows SAP DBTech JDBC: [1287]: identifier must be declared: K . which I had declared.

 

If i delete "TAB2 = " in the loop, it's fine.

 

CREATE COLUMN TABLE TRAFFIC.TTEST(

    AB1 INT,

    AB2 INT

);

 

INSERT INTO TRAFFIC.TTEST VALUES(1,2);

INSERT INTO TRAFFIC.TTEST VALUES(2,3);

 

DROP PROCEDURE TRAFFIC.TTTEST;

CREATE PROCEDURE TRAFFIC.TTTEST()

LANGUAGE SQLSCRIPT AS

BEGIN

DECLARE K INT :=1;

DECLARE TEMP INT ARRAY;

TAB1 = SELECT AB1 FROM TRAFFIC.TTEST;

TEMP := ARRAY_AGG(:TAB1.AB1);

FOR K IN 1..2 DO

  TAB2 = SELECT * FROM TRAFFIC.TTEST WHERE TO_INT(AB1) = :TEMP[:K];

END FOR;

END;

 

CALL TRAFFIC.TTTEST();

 

Thanks in advance.

 

Best,

Shu


Viewing all articles
Browse latest Browse all 4343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>