Hi. I have created an explicit cursor loop, but this is returning only the last value. The cursor itself is defined as a function. The function is called as a line in a procedure, which is inserting into a table. I am using the results from the cursor to insert lines in a table. All lines are correctly inserted, except for the values returned from the cursor, which is always the last value found from the loop. I noticed online that the command NEXT RECORD should resolve this issue, but PLSQL won't recognize this. The cursor loop looks like this:
BEGIN
OPEN Quant_Requested;
LOOP
FETCH Quant_Requested
INTO v_rob_qty, v_req_qty, v_app_qty;
EXIT WHEN Quant_Requested%NOTFOUND;
NEXT RECORD; --PLS-00103 Encountered the symbol 'RECORD'
END LOOP;
CLOSE Quant_Requested;
FIRST RECORD;
END;
RETURN v_req_qty;
END;
The question now is, how can I get oracle to process each and every line, rather than just the last result found?