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

DB2 Multi row fetch


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

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Mon Nov 11, 2013 11:45 pm
Reply with quote

What will be the SQL code at the last rowset fetch in case of multirow fetch in DB2. And exactly when it'll get SQL Code 100..
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Tue Nov 12, 2013 11:34 am
Reply with quote

Hi,

I will try to explain with an example.

Suppose you have a select query which will fetch around 250 rows and you have an cursor associated with query which is multi-fetch cursor with rowset positioning for 100 rows.

In such case you will get sqlcode 100 for the third fetch.

For first two fetches it will retrieve 100 rows each along with sqlcode 0 and third fetch will return only 50 rows along with sqlcode 100.

Hope this helps

Regards,
Chandan
Back to top
View user's profile Send private message
Dhrubojoty mukherjee

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Tue Nov 12, 2013 7:58 pm
Reply with quote

Thanks Chandan for your reply. But I just want to know when it gets SQL code +354..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19245
Location: Inside the Matrix

PostPosted: Tue Nov 12, 2013 8:15 pm
Reply with quote

Hello,

Why did you not mention the +354 originally?

We can't help much if you don't post the question you want answered . . .
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Tue Nov 12, 2013 8:24 pm
Reply with quote

when some rows have warnings
Warnings like
+802 if you fetch colA / colB and sometimes colB is zero.
+445 Truncation has occured
...
Back to top
View user's profile Send private message
Dhrubojoty mukherjee

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Wed Nov 13, 2013 11:04 pm
Reply with quote

So when some one gets sql code +354, it warns that it is the last row set fetch.And at the next row set fetch it'll get 100.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Nov 13, 2013 11:07 pm
Reply with quote

Dhrubojoty mukherjee wrote:
So when some one gets sql code +354, it warns that it is the last row set fetch.And at the next row set fetch it'll get 100.

No.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Thu Nov 14, 2013 11:59 am
Reply with quote

Though Guyc is already explained let me try to explain again and I would suggest you to refer manuals.

This is what manual says for + 354
+354
A ROWSET FETCH STATEMENT MAY HAVE RETURNED ONE OR MORE ROWS OF DATA. HOWEVER, ONE OR MORE WARNING CONDITIONS WERE ALSO ENCOUNTERED. USE THE GET DIAGNOSTICS STATEMENT FOR MORE INFORMATION REGARDING THE CONDITIONS THAT WERE ENCOUNTERED


Lets say you are fetching 100 rows in a fetch and out of 100 rows around 10 rows has any sql error or warning then you will get +354

Hope its clear now

Regards,
Chandan
Back to top
View user's profile Send private message
Dhrubojoty mukherjee

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Thu Nov 14, 2013 9:09 pm
Reply with quote

Thanks a ton ...Chandan.... icon_biggrin.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 the record number from FMNMAIN ... CLIST & REXX 10
No new posts Fetch the Dataset names from inside m... TSO/ISPF 18
No new posts How to fetch the latest record from a... DFSORT/ICETOOL 8
No new posts Position BSAM file on multi volume PL/I & Assembler 3
No new posts To fetch value separated by commas fr... DB2 3
Search our Forums:

Back to Top