Skip to Content
Former Member
Jun 10, 2017 at 02:37 PM

hana studio indefinitely executes the below query



while running the below code hana goes into indefinite run time.

Any help will be appreciated.

CREATE PROCEDURE "FOR_LOOP_EXAMPLE"() LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS /*********BEGIN PROCEDURE SCRIPT ************/ BEGIN DECLARE v_index INT=1; DECLARE v_index2 INT=1; DECLARE min INT ; DECLARE max INT ; create table t( rownum int, itemcode varchar(50)); Insert into t SELECT Row_Number() OVER (ORDER BY T0."ItemCode" ) as a ,T0."ItemCode" FROM OITM T0 WHERE T0."ItemCode" in('I03515','I04289'); SELECT (SELECT MIN(rownum) FROM t) INTO min FROM DUMMY; SELECT (SELECT MAX(rownum) FROM t) INTO max FROM DUMMY; -- select min as min,max as max FROM DUMMY; FOR v_index IN :min .. :max DO FOR v_index IN 1 .. 1 DO Select v_index from dummy; select * from oitm where "ItemCode" in (Select itemcode from t where rownum=v_index); END FOR; END FOR; -- Select * from t; drop table t; END; CALL "FOR_LOOP_EXAMPLE"();