Home > General > Oracle Sproc Tip

Oracle Sproc Tip

August 4th, 2008

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.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • TwitThis

About the Author

Craig Tataryn started his career as a Visual Basic programmer, but don't hold that against him! The system he helped create was a cutting edge, n-tiered revenue collection system whose transactions per second metric was off the charts! Around the year 2000 he discovered Struts and never looked back. A professional Java developer for close to a decade, Craig has worked on a wide variety of projects ranging from Recruiting, Purchase order, Revenue collection and Mortgage systems. More recently Craig has written web services for children's educational toys and has honed his skills on Wicket, Facebook and iPhone application development. "I love to learn and more importantly I love to teach. Hoarding knowledge is one of the most petty and selfish things you can do, especially as a contractor. This is why I always make it a point to document and share my knowledge with my client's employees"

craig General

  1. No comments yet.
  1. No trackbacks yet.