Hello all:
I have the following code in my stored proc to get the entire recordset. I am checking each record in this "TEMPREC" and i m also checking the condition of varialeb "i_copy_Notes". if it is equal to 1 then i want to move to next record. When i use "NEXT" . the compiler flags that next must be declared.
Please let me know how to move to next record.
Thanks
FOR TEMPREC IN
(
SELECT
DP_SER,
GRD_POS,
TS_POS,
ASG_ID,
DESCS,
GRD_ID
FROM DCGRD_POS
WHERE CLLI = i_FROM_CLLI AND SUBSYS = i_SUBSYS AND BAY_ID = v_OLD_BAY_ID ORDER BY GRD_ID
)
LOOP
IF v_OLD_GRDID = TEMPREC.GRD_ID THEN
v_NEW_GRDID := v_NEW_GRDID;
IF i_COPY_NOTES = 1 THEN
NEXT;
END IF;
ELSE
v_OLD_GRDID := TEMPREC.GRD_ID;
SELECT DCGRD_POS_GRD_ID.NextVal INTO v_NEW_GRDID FROM DUAL;
END IF;
INSERT INTO DCGRD_POS VALUES
(
i_TO_CLLI,
DCGRD_POS_ROW_SER.NextVal,
TEMPREC.DP_SER,
v_NEW_GRDID,
v_NEW_BAY_ID,
TEMPREC.GRD_POS,
DECODE(i_COPY_NOTES,1, TEMPREC.TS_POS,''),
TEMPREC.ASG_ID,
DECODE(i_COPY_NOTES,1,TEMPREC.DESCS,'UASGN'),
i_CURRENT_ISSUE,
-1,
i_SUBSYS,
SYSDATE,
i_USERID
);
END LOOP;NEXT