[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DB2 Out Parameters with result Set

Posted on 2011-09-30
4
Medium Priority
?
421 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 46

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 46

Accepted Solution

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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

649 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