Oracle Sproc Tip

Posted by craig

A colleague of mine, Guillermo Castro, showed me how to print the results of a stored procedure call that returns a ref cursor in Oracle.

In SqlDeveloper you would make a script like so:

var results ref cursor;
var o_status number;
var o_err_msg varchar2;
exec :results := myschema.MY_SPROC(773490, 'TEST', :o_status, :o_err_msg);
print results;
print o_status;
print o_err_msg;

This will output the values of the refcursor (a result set generated by MY_SPROC) as well as two “normal” out parameters :o_status and :o_err_msg.