I want to pass sys_refcursor as an argument to a procedure in PL/SQL. I have used the following codes to create a procedure
create or replace procedure reffunmani(
cname varchar2,
mysys out sys_refcursor)
is
begin
open mysys for
select /*c.ins_id,c.cname, c.start_date,*/i.ins_id,i.ins_name
from course c,institution i where c.ins_id=i.ins_id
order by c.start_date;
end;
/
show errors;
and i have called the same procedure i an anonymous block
declare
mysys sys_refcursor;
rec institution%rowtype;
begin
reffunmani('MCA',mysys);
loop
fetch mysys into rec;
exit when mysys%notfound;
dbms_output.put_line(rec.ins_id||' '||rec.ins_name);
end loop;
close mysys;
end;
/
When I execute my anonymous block, I get an error
ORA-06504: PL/SQL: Return types of Result Set variables or query do not match
ORA-06512: at line 7
Note that the institution
table has 5 columns.