Code: Select all
create or replace procedure cursor_test1( p_deptno IN number
, p_cursor OUT
REFCURSOR_PKG.WEAK8i_REF_CURSOR)
as
begin
open p_cursor FOR
select *
from emp
where deptno = p_deptno;
end cursor_test1;
/** From Oracle 9 */
create or replace procedure cursor_test2( p_deptno IN number
, p_cursor OUT SYS_REFCURSOR)
as
begin
open p_cursor FOR
select *
from emp
where deptno = p_deptno;
end cursor_test2;
/* Strong type */
create or replace procedure cursor_test3( p_deptno IN number
, p_cursor OUT REFCURSOR_PKG.STRONG_REF_CURSOR)
as
begin
open p_cursor FOR
select *
from emp
where deptno = p_deptno;
end cursor_test3;Code: Select all
create or replace package REFCURSOR_PKG as
TYPE WEAK8i_REF_CURSOR IS REF CURSOR;
TYPE STRONG_REF_CURSOR IS REF CURSOR RETURN EMP%ROWTYPE;
end REFCURSOR_PKG;
/** until Oracle 9 */
create or replace procedure test( p_deptno IN number
, p_cursor OUT
REFCURSOR_PKG.WEAK8i_REF_CURSOR)
is
begin
open p_cursor FOR
select *
from emp
where deptno = p_deptno;
end test;
/** From Oracle 9 */
create or replace procedure test( p_deptno IN number
, p_cursor OUT SYS_REFCURSOR)
is
begin
open p_cursor FOR
select *
from emp
where deptno = p_deptno;
end test;
/* Strong type */
create or replace procedure test( p_deptno IN number
, p_cursor OUT REFCURSOR_PKG.STRONG_REF_CURSOR)
is
begin
open p_cursor FOR
select *
from emp
where deptno = p_deptno;
end test;--
Martijn Tonies
Upscene Productions