Hello fellows, I am very new to stored procedures. I am trying to make a stored procedure which would perform an update accepting 2 input parameters and return the number of records updated (in my case always 1).
I have managed till this so far but I don't understand how to return the variable after opening the cursor. Is the cursor necessary at all in my case ? Please correct me if my approach is wrong.
CREATE PROCEDURE PAKRETST.FTUMODINST (IN GENFORTREATYSRNO INTEGER,IN GENFTMDPDUENO INTEGER, OUT NUMREC SMALLINT)
RESULT SETS 0 MODIFIES SQL DATA LANGUAGE SQL
P1:BEGIN
DELCARE strCmd VARCHAR(500);
DECLARE x CURSOR WITH RETURN TO CALLER FOR SL;
SET strCmd='UPDATE PAKRETST.UWFTMDPDUEDATES a where a.GENFORTREATYSRNO='||GENFORTREATYSRNO||'AND a.GENFTMDPDUENO='||GENFTMDPDUENO;
PREPARE SL FROM strCmd;
SET NUMREC= -- Stuck here --
RETURN;
END
;