Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Iteration over SQL result in SQLScript procedure has an error

$
0
0

Hello,

I want to iterate over the resultset of a sql select in a procedure. I tried  the example code from http://help.sap.com/hana/SAP_HANA_SQL_Script_Reference_en.pdf

unfortunately it does not work

 

Here is my procedure code, I'm doing a more or less basic SQL Select with a where and group_by.

 

CREATE PROCEDURE _SYS_BIC.reduce_bdd(          in profileId VARCHAR(100)
)            LANGUAGE SQLSCRIPT          SQL SECURITY INVOKER          READS SQL DATA AS 

-- DECLARE CURSOR
BEGIN 
 DECLARE CURSOR c_cursor1 FOR 
 SELECT "Dependency", "TrueDepId", "FalseDepId", "DependencyId" 
 FROM "user"."helloWorld.data::obdd" 
 WHERE "ProfileId" = :profileId 
 ORDER BY  "TrueDepId" ASC, "FalseDepId" ASC, "Dependency" ASC;

 -- ITERATION
FOR cur_row as c_cursor1 DO
v_profileId := cur_row.ProfileId;
END FOR;

END;

Like I said, I'm using the example code from the reference but I get the error that cur_row is an invalid identifier. I was not able to figure out if i have to declare it and how.

 

ERROR helloWorld/models/reduce_bdd.procedure

Repository: Internal error during statement execution, please see the database error traces for additional details;error executing statement; invalid identifier: CUR_ROW: line 15 col 17 (at pos 583) at ptime/query/checker/check_id.cc:365

 

Hopefully someone can help me.

 

Thanks a lot & kind regards,

  Stefan


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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