注意:此文档是本人写的
create or replace package test_pack as
type ref_cursor is ref cursor;
end;
/
create or replace procedure get_rest(n in number,rst out test_pack.ref_cursor)
as
begin
open rst for select deptno,dname,ename,sal
from (select dept.deptno,dname,ename,sal ,row_number() over(partition by dept.deptno
order by sal desc ) cnt from emp,dept where dept.deptno=emp.deptno)
where cnt<=n;
end;
/
create or replace function get_rest(n in number)
return test_pack.ref_cursor
as
v_rst test_pack.ref_cursor;
begin
open v_rst for select deptno,dname,ename,sal
from (select dept.deptno,dname,ename,sal ,row_number() over(partition by dept.deptno
order by sal desc ) cnt from emp,dept where dept.deptno=emp.deptno)
where cnt<=n;
return v_rst;
end;
/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/50509/viewspace-174250/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/50509/viewspace-174250/