Solved

DB2 Out Parameters with result Set

Posted on 2011-09-30
4
388 Views
Last Modified: 2012-05-12
Hi,
   I have a stored procedure to write in DB2 and was planning to bring the result as result set, using a cursor with return to the caller.
  My colleague was suggesting that i write it with a combination of out parameters and result sets.
  Is it possible to have both result set and out parameters to contain in one stored procedure?
 
0
Comment
Question by:pvsbandi
  • 2
  • 2
4 Comments
 
LVL 45

Expert Comment

by:Kdo
ID: 36891517
Hi pvsbandi,

Sure.  You can do both.  If you'll explain your project a bit perhaps we can suggest a reasonable solution.


Kent
0
 

Author Comment

by:pvsbandi
ID: 36892065
Hi Kent,

   Basically, there are different sections on my report. Some of the sections have only 1 value at any time.
  But there are some other sections, which can have repeating details.
  So, my lead is asking me to have the one -one value fields as OUT parameters and the ones, which might repeat, to have as the result sets.
0
 
LVL 45

Accepted Solution

by:
Kdo earned 500 total points
ID: 36892121

That's actually a very rational way to do that.  The returned parameters become the items that you need to access first or randomly (plug into headers, etc.) and the returned table is the row data.

Depending on your needs, you might also use a global temporary table, particularly if you need to make multiple queries against the data or pass the results to another stored procedure.

I'm not usually a fan of global temporary tables, but they do have their uses.


Kent
0
 

Author Closing Comment

by:pvsbandi
ID: 36892136
Thank You!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now