IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Question regarding multi row fetch in DB2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Mon Dec 07, 2009 7:17 pm
Reply with quote

Hi All,
I declared a cursor for the multi row fetch
I am fetching like below.
Code:
 FETCH NEXT ROW SET CS1 FOR 10 ROWS INTO
:WS-A,
:WS-B;


My question is that.If in table there is only 5 rows present which is satisfying my criteria. Whats will be the SQLCODE which i will get.Is it 100? And alos will i get 5 rows in my WS-A, WS-B variables?
Back to top
View user's profile Send private message
Steve Davies

New User


Joined: 15 Oct 2009
Posts: 32
Location: UK

PostPosted: Mon Dec 07, 2009 7:27 pm
Reply with quote

Yes and yes. And to answer the next question you're about to ask....."How do I know how many rows the FETCH has returned?", you need to check the SQLCA field SQLERRD(3) which is populated after the FETCH with the number of rows that DB2 fetched.
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Mon Dec 07, 2009 7:37 pm
Reply with quote

Thanks alot Steve for the quick reply icon_rolleyes.gif icon_razz.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Fetch data from programs execute (dat... DB2 3
No new posts Question for file manager IBM Tools 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts question for Pedro TSO/ISPF 2
No new posts Code Multi Row fetch in PL1 program PL/I & Assembler 1
Search our Forums:

Back to Top