If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Questions about Stored procedure result sets

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-08-10, 11:42
Balr14 Balr14 is offline
Registered User
 
Join Date: Sep 2002
Location: Wisconsin
Posts: 37
Questions about Stored procedure result sets

DB2 allows a calling program to receive an entire result set from a stored procedure, by specifying something like "FETCH xxxxxxx FOR 500 ROWS INTO array". It's my guess this doesn't really have any effect on the way the cursor actually performs and is simply a way to transmit more data between calling program and SP. Since the calling program and SP run in different address spaces, the savings are simply due to fewer address space swaps.
Please comment.
Reply With Quote
  #2 (permalink)  
Old 11-08-10, 13:17
dbzTHEdinosaur dbzTHEdinosaur is offline
Registered User
 
Join Date: Jun 2007
Location: germany
Posts: 96
the quote below comes from What's New in db2 vsn 8 (which is where you can find Figure 7, if you are so inclined)
, which is when multi-row fetch.... was introduced.
There is more in the
DB2 UDB for z/OS Version 8 Technical Preview, a Redbook found here
as well as this Redbook:
DB2 UDB for z/OS Version 8: Everything You Ever Wanted to Know, ... and More
found here


Multiple fetches and inserts allowed within a single SQL statement
You can enhance the performance of your application programs by using multiple-row FETCH and INSERT statements to request that DB2 send multiple rows of data, at one time, to and from the database. Using these multiple-row statements in local applications results in fewer accesses of the database. Using these multiple-row statements in distributed applications results in fewer network operations and a significant improvement in performance. Figure 7 illustrates the difference between a series of single fetches and a single, multiple-row fetch operation.
__________________
Dick Brenholtz, Ami in Deutschland
Reply With Quote
  #3 (permalink)  
Old 11-08-10, 14:02
Balr14 Balr14 is offline
Registered User
 
Join Date: Sep 2002
Location: Wisconsin
Posts: 37
"Using these multiple-row statements in distributed applications results in fewer network operations and a significant improvement in performance" would seem to support what I said. If this were an advantage to the way the cursor performs, why wouldn't it be offered in a conventional batch DB2 program?
Reply With Quote
  #4 (permalink)  
Old 11-08-10, 14:53
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You have a different/new interface. The precompiler has to support that in order to generate the respective constructs in the host language.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 11-08-10, 14:58
dbzTHEdinosaur dbzTHEdinosaur is offline
Registered User
 
Join Date: Jun 2007
Location: germany
Posts: 96
Quote:
Originally Posted by Balr14
If this were an advantage to the way the cursor performs, why wouldn't it be offered in a conventional batch DB2 program?
If you have DB2 Vsn 8 (or higher), whether on mainframe or pc, you have multi-row constructs available.
__________________
Dick Brenholtz, Ami in Deutschland
Reply With Quote
  #6 (permalink)  
Old 11-08-10, 15:51
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
There is no advantage to the way cursor performs. The benefit is you would perform far less fetches than you currently do. And, it is available for use in a conventional batch DB2 program.

Dave
Reply With Quote
  #7 (permalink)  
Old 11-08-10, 16:11
Marcus_A Marcus_A is online now
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by Balr14 View Post
"Using these multiple-row statements in distributed applications results in fewer network operations and a significant improvement in performance" would seem to support what I said. If this were an advantage to the way the cursor performs, why wouldn't it be offered in a conventional batch DB2 program?
This applies to a distributed client application calling a stored procedure, but not one stored procedure calling another stored procedure if both stored procedures are on the same physical server. Same applies to a batch program running on the database server.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 11-09-10, 02:48
yijianlian yijianlian is offline
Registered User
 
Join Date: Nov 2010
Posts: 2
Some, of course, will complain about WOW Gold the result, including those desperados in the stock exchange, the crave for any type of shock, however cynically orchestrated to Buy WOW Gold Japan from its economic and financial lethargy jerk. There are many reasons to doubt that Mr. Kan has the charisma and the ability to re-energize the country. He has failed to use the campaign to light on the need for final fantasy gil. He is WOW Power Leveling still not sufficient to achieve rival parties, the Aion Gold parliamentary havebeen overcome, he lost face for the DPJ Upper House majority in July.
Reply With Quote
  #9 (permalink)  
Old 11-09-10, 07:28
Balr14 Balr14 is offline
Registered User
 
Join Date: Sep 2002
Location: Wisconsin
Posts: 37
Quote:
Originally Posted by Marcus_A View Post
This applies to a distributed client application calling a stored procedure, but not one stored procedure calling another stored procedure if both stored procedures are on the same physical server. Same applies to a batch program running on the database server.
In other words, I can't use this feature in a batch DB2 program that calls a DB2 module. I tried it in a batch COBOL program that invoked a COBOL stored procedure. It was pretty disappointing..... due to address space swaps.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On