Toad World® Forums

Testing package procedures


#1

I have a package that declares a cursor_type as ref cursor
so
Create or Replace PACKAGE DEV.“PKG_TEST” is
TYPE cursor_type is REF CURSOR;

procedure doSomething(p_cur OUT cursor_type, pSearch varchar2);

End PKG_TEST;

Create or Replace Package Body DEV.“PKG_TEST” is
procedure doSomething(p_cur OUT cursor_type, pSearch varchar2)
as
begin

end
END PKG_TEST;

To test in TOAD Trial I did this

Declare type resultSet is ref cursor;
Begin
PKG_TEST.doSomething(:resultSet, ‘SearchString’)’
End

Now I get wrong number or types of argument in call. Any ideas?


#2

variable rf refcursor

print rf

– the test procedure code is:

create or replace procedure test_procedure(par_1 varchar2,
p_rf out sys_refcursor) is
begin
open p_rf for ;
end;
/

Toad conveniently displays resut of print statement as a grid

Boris

The way I am using to test procedure with refcursor as a parameter is just a bit differ:

– run in TOAD under F5(execute as a script)
exec test_procedure(p_rf => :rf )


#3

Hi man, thanks, your code work for me. In Toad 10.1.1.8 I use:

variable salida refcursor

exec MY_PKG.MY_PRC( 1, 2, 3, :salida)

print salida

Then, Execute as Script.