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

For loop using decimals in SAP HANA

$
0
0

Hi ,

 

I am trying to create & execute the below procedure  and It is throwing error if I use decimal in the for loop .

 

 

CREATE PROCEDURE for_proc LANGUAGE SQLSCRIPT AS

    v_index1 INT;

   v_index2 DECIMAL(5,2);

    v_msg    VARCHAR(200);

BEGIN

    init_proc();

 

    FOR v_index1 IN -2 .. 2 DO

       FOR v_index2 IN REVERSE 0.5 .. 5.5 DO

            v_msg := 'Here is '|| :v_index1 || '-' || :v_index2 || '.';

            ins_msg_proc(:v_msg);

        END FOR;

    END FOR;

END;

 

Can we use decimal values in the for loop as shown in the above example.

 

If yes how can we use decimal values in the for loop.

 

How can handle the increments in the for loop.

 

In the above example  for statement FOR v_index1 IN -2 .. 2 DO it  is incrementing -2,-1,0,1,2 like that .  If we want to increment by 2  how can we write the for loop statement.

 

 

Please help me in this clarifications.

 

Thanks & Regards,

Ramana.

 

 

 


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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