# Testing package procedures

**URL:** <https://forums.toadworld.com/t/testing-package-procedures/11221>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [August 2, 2012, 12:18pm UTC](https://forums.toadworld.com/t/testing-package-procedures/11221 "2012-08-02T12:18:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JCstrider](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@JCstrider](https://forums.toadworld.com/u/JCstrider)\
**Post date:** [August 2, 2012, 12:18pm UTC](https://forums.toadworld.com/t/testing-package-procedures/11221/1 "2012-08-02T12:18:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Boris.levitan\_343](https://avatars.discourse-cdn.com/v4/letter/b/9e8a1a/32.png) [@Boris.levitan\_343](https://forums.toadworld.com/u/Boris.levitan_343)\
**Post date:** [August 2, 2012, 1:17pm UTC](https://forums.toadworld.com/t/testing-package-procedures/11221/2 "2012-08-02T13:17:26Z")

</div>

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 )

---

<div class="post-metadata">

**Author:** ![hernaldog](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hernaldog](https://forums.toadworld.com/u/hernaldog)\
**Post date:** [June 8, 2015, 12:42pm UTC](https://forums.toadworld.com/t/testing-package-procedures/11221/3 "2015-06-08T12:42:45Z")

</div>

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.
