I am trying to create an ORACLE stored procedure that selects some info into a cursor, run some updates on that cursor. Then return the contents of the cursor, this is to move away from the current setup that involves creating a temp table and running queries on that.
Everything that I have tried has resulted in the contents of the cursor being out of scope of any updates etc that I want to run..
Essentially I'm trying to:
- Select some data
- Do some processing on it
- Return some of the processed data (based on a select)
Please help!
My current code is along the lines of:
create or replace
PROCEDURE TEMP_REPORT
(
returnTable OUT SYS_REFCURSOR
)
IS
CURSOR resultTable
IS
SELECT FNAME,SALARY FROM STAFF;
NAME VARCHAR2 (10);
SALARY VARCHAR2 (10);
BEGIN
Update resultTable set Salary = (salary * 1.1);
--- some more processing here
---- now return the datarows
Cursor returnTable from select name, salary from resultTable where salary > 1000;
END TEMP_REPORT;