• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

DB2 Out Parameters with result Set

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
pvsbandi
Asked:
pvsbandi
  • 2
  • 2
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi pvsbandi,

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


Kent
0
 
pvsbandiAuthor Commented:
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
 
Kent OlsenData Warehouse Architect / DBACommented:

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
 
pvsbandiAuthor Commented:
Thank You!
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now