Hi,
I have problem in passing parametre to cursor in an procedure.
Below is the procedure, in which I have tried to builde a string of data seperated by comma. When I pass this comma seperated string to cursor it is not returning me any data. At the same time it is not returning me any error as well.
I tried to print and see whether I am passing the correct data to the cursor. and It looked fine to me.
The same procedure will work fine if I hard code the values (Like in my procedure v_orderNumberStr = '97637'

But the same will not work when I dyanmicaaly build the string and pass it to cursor.
Can anybody please tell me what is the problem in procedure.
CREATE PROCEDURE SP_GET_DEALER_SHIP_BUILDER(
IN custBase VARCHAR(7),
IN custSuffix VARCHAR(6)
)
DYNAMIC RESULT SETS 2
LANGUAGE SQL
P1: BEGIN
DECLARE v_orderNumber INTEGER DEFAULT 0;
DECLARE v_orderNumberStr VARCHAR(1040);
DECLARE v_orderNumberStr1 VARCHAR(1040);
DECLARE curDlrShipBuilder CURSOR FOR
SELECT CHAR(R1SSNG) FROM LCR1CPP WHERE CHAR(R1SSNG) in (v_orderNumberStr1) ORDER BY 1;
SET v_orderNumberStr = '97637';
BEGIN
FOR v_row AS SELECT R1SSNG FROM LCR1CPP WHERE R1WKCD='3917' AND R1WLCD='0' AND R1MCSV='00' and R1ZVCD='P' and R1ONSV='L'
DO
SET v_orderNumberStr = v_orderNumberStr || ', ' || TRIM(CHAR( v_row.R1SSNG)) ;
END FOR;
END;
SET v_orderNumberStr1 = TRIM(CHAR(v_orderNumberStr));
BEGIN
--OPEN curDlrShipBuilder1;
OPEN curDlrShipBuilder;
END;
END P1
Thanks and Regards,
Babu