Solved

DB2 Out Parameters with result Set

Posted on 2011-09-30
4
396 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: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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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