sql - Stored Procedure Update a Cursor then Return the Result -


i trying create oracle stored procedure selects info cursor, run updates on cursor. return contents of cursor, move away current setup involves creating temp table , running queries on that.

everything have tried has resulted in contents of cursor being out of scope of updates etc want run..

essentially i'm trying to:

  1. select data
  2. do processing on
  3. return of processed data (based on select)

please help!

my current code along lines of:

create or replace procedure temp_report (   returntable out sys_refcursor )   cursor resulttable     select fname,salary staff;     name     varchar2 (10);    salary   varchar2 (10);  begin       update resulttable set salary = (salary * 1.1);     --- more processing here     ---- return datarows     cursor returntable select name, salary resulttable salary > 1000;   end temp_report; 

what not try simpler :

declare     name     varchar2 (10);    salary   varchar2 (10);  begin  cid in ( select fname,salary staff) loop        name := cid.name;       salary := cid.salary;        dbms_output.        put_line (             name          || ' | '          || salary); end loop;  end; 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -