Tuesday, 25 November 2008

Viewing a Refcursor in TOAD

Run a PL/SQL block in the SQL editor as follows:<br />declare<br />begin<br />   OPEN :pv_cur FOR 'select * from dual';<br />end;<br /><br />Or if you have a function returning a refcursor<br /><br />declare<br />BEGIN<br />   :pv_cur := function_name(param1,param_etc);<br />END;<br /><br />TOAD will prompt you for the datatype/value of ':pv_cur'. <br />Change the type to 'Cursor' and leave the value blank, hit OK. <br />The ref cursor will be displayed in the standard data grid below, as if you had run a query.<br /><br /><br />