create or replace procedure testcur(STATIONID IN VARCHAR2,out_result_cursor out sys_refcursor)
is
v_sql varchar(200);
begin
v_sql:='select a.stationid,a.boxid from RPT_TVMCASHBOX a
where a.stationid='||STATIONID;
open out_result_cursor for v_sql;
end;
---------------------------------------------------------------
declare
c_result sys_refcursor;
c c_result%type;
arr test_table%rowtypr;
begin
testcur(c);
loop
fetch c into arr;
dbms_output.put_line(arr.boxid);
exit when c%notfound;
end loop;
close c;
end;