由于Oracle存储过程中所有返回值是通过out参数代替的,但是集合不能用一般的参数,必须使用package,所以分两部分:
第一步:定义一个包头
create or replace package mypackage is
--声明一个游标
type empcursor is ref cursor;
procedure queryEmpList(ecode in number,empList out empcursor);
END mypackage ;
第二步:在包体中实现包头中的方法
create or replace package body mypackage is
procedure queryEmpList(ecode in number,empList out empcursor) is
begin
open empList for select * from emp where depcode = ecode ;
end queryEmpList;
END mypackage;