I am trying to build an dynamic cursor based on parameters based into my stored procedure.
Here is my Variable:
SET V_SQL = 'SELECT MAWHS, MAPLNR, MAADTE, MAPROD, MAMBAL, MAMREQ, MACOMP, IDESC
FROM TESTF.DMA DMA, TESTF.IIM IIM
WHERE DMA.MAPROD = IIM.IPROD AND (MAPROD >= ' || FROM_ITEM || ' AND MAPROD <= ' || TO_ITEM || ')
AND (MAPLNR >= ' || FROM_PLANNER || ' AND MAPLNR <= ' || TO_PLANNER || ')
AND MAADTE <= ' || ACTION_DATE
|| ' AND MAWHS = ' || WAREHOUSE
|| ' AND MAMBAL = ' || MIN_BALANCE
|| ' AND MAMREQ = ' || MATERIAL_REQ;
I am setting my where clause with variables based in I have one problem all my variables are char except ACTION_DATE it is a DECIMAL(8,0) how to I concatentate this decimal parameter to my V_SQL which is defined as varchar(500)?