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

Help with cursor in HANA

$
0
0

Hello community experts!

 

I hope you all had a great weekend! I am having a lot of problems with the cursors in SAP HANA 6.0 and was wondering if any of you can help me with this. I am kind of a beginner and it took me a while to get to this point, so please don't mock me if this is a silly question!

 

Here's the problem, I have a table populated with an ID column, month of year column, year column and order quantity. Each unique ID has 24 rows of information. What I am trying to do here is I'm attempting to run the PAL triple smoothing function within the PAL library on the data I got. I created the cursor procedure as seen below so I can process the data by unique ID. However, whenever I try to run the "CALL _SYS_AFL.TRIPLESMOOTH_TEST" within the FOR loop, it gives me an error saying "SAP DBTech JDBC: [7] (at 501): feature not supported: Only table variable is allowed in input parameter in a nested call: line 12 col 45 (at pos 501) ". I am not certain where this error is coming from, as I've seen from some HANA documentation that it is possible to have a procedure called within a for loop, specifically in a cursor. My code is attached in the next paragraph, all the tables mentioned were created properly beforehand so I omitted it here to save space. and the triple smoothing procedure was tested and it runs properly on dummy data.


DROP PROCEDURE cursor_proc;

CREATE PROCEDURE cursor_proc LANGUAGE SQLSCRIPT AS

 

BEGIN

      DECLARE CURSOR c_cursor1 FOR

      SELECT distinct "id" FROM ZLI."Month_Model_3";

            FOR cur_rec as c_cursor1 DO

            insert into "ZLI"."CURRENT_ID_TABLE"

          (select cast(cast("year" as varchar(4)) || left(concat('0', cast("month_of_year" as varchar(4))), 2) as integer), "month_order"

            FROM "ZLI"."Month_Model_3"

            where "id"=cur_rec."id");

            CALL _SYS_AFL.TRIPLESMOOTH_TEST("ZLI"."CURRENT_ID_TABLE", "#PAL_CONTROL_TBL", "PAL_TRIPLESMOOTH_RESULT_TBL") with overview;

            End FOR;         

END;

CALL cursor_proc() with overview;

SELECT * FROM "ZLI"."CURRENT_ID_TABLE";

 

 

Here's what I've tried, I've tried calling the triple smooth procedure after the table has been created. This gave me results, however, it is a prediction from the entire table and I need it to be in the loop so I get the prediction by ID.


Please let me know what your thoughts are on this. Any advice/auggestions are appreciated! Thanks in advance!


 

 

 

 


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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