DB2

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesDB2

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old December 22nd, 2008, 11:38 PM
vinayakshukre vinayakshukre is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2008
Posts: 2 vinayakshukre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 11 sec
Reputation Power: 0
Cursor as out parameter

I am new to DB2 and stored procedure writing..

Is it possible to use cursor as out parameter of stored procedure like oracle ?

How DB2 stored procedure can return multiple rows?

Thanks in advance.

Reply With Quote
  #2  
Old October 15th, 2013, 09:43 AM
mperemsky mperemsky is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Oct 2013
Posts: 1 mperemsky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 17 sec
Reputation Power: 0
DB2 Does not return Cursors as parameters

Not sure of your version, but v9.1 does not return CURSORS as parameters as Oracle does. You need to declare the number of DYNAMIC RESULT SETS to be returned, then define a cursor to be returned within the procedure

Code:
CREATE PROCEDURE "GET_MODELS" ( IN "P_EQUIPMENT_TYPE" VARCHAR(30) )
  DYNAMIC RESULT SETS 1
  READS SQL DATA
 ...
BEGIN

  -- Declare a cursor to hold the results of a select statement
  DECLARE cursor1 CURSOR WITH RETURN TO CALLER FOR

  -- define the select statement for the cursor being returned
        SELECT distinct (model_number) 
        FROM ATS_EQUIPMENT 
        WHERE EQUIPMENT_TYPE = P_EQUIPMENT_TYPE;

  -- open the cursor being returned
  OPEN cursor1;


In the Java code use the following to get each cursor in order

Code:
stmt.getResultSet();

Reply With Quote
  #3  
Old October 16th, 2013, 10:18 PM
vinayakshukre vinayakshukre is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2008
Posts: 2 vinayakshukre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 11 sec
Reputation Power: 0
Thanks for your reply.

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesDB2 > Cursor as out parameter


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap