Solved

DB2 Out Parameters with result Set

Posted on 2011-09-30
4
397 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 45

Expert Comment

by:Kent Olsen
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:
Kent Olsen 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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