MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 Cursors

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Maximus
Beginner


Joined: 17 Nov 2005
Posts: 21
Topics: 11

PostPosted: Wed Mar 22, 2006 5:22 am    Post subject: DB2 Cursors Reply with quote

What will be the error code, if the the query in the decalre cursor doesn't returns any value when we open the cursor?


Thanks
Max
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 22, 2006 5:36 am    Post subject: Reply with quote

Maximus,

You will not get an error code as the open statement does not care if there are any result set rows.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Maximus
Beginner


Joined: 17 Nov 2005
Posts: 21
Topics: 11

PostPosted: Wed Mar 22, 2006 5:56 am    Post subject: Reply with quote

Thanks Kolusu.

Suppose if we perform fetch operation on the same cursor after open? What would be the error code??

Whether it will be +100.

Kindly confirm this.

Thanks
Max
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 22, 2006 5:59 am    Post subject: Reply with quote

Maximus,

yes you would get a sqlcode of +100 upon the first fetch if the result set is empty.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Maximus
Beginner


Joined: 17 Nov 2005
Posts: 21
Topics: 11

PostPosted: Wed Mar 22, 2006 7:40 am    Post subject: Reply with quote

Thanks Kolusu.


Max
Back to top
View user's profile Send private message
raam_narayan
Beginner


Joined: 28 Apr 2006
Posts: 12
Topics: 2

PostPosted: Wed May 03, 2006 4:35 am    Post subject: Reply with quote

Hi,

The basic thing u should understand is that when u r using the Cursor there are 4 operations which is involved.. i.e. Declare,open,Fetch and close.. Ur question states that what would be the SQL CODE when decalre cursor doesn't returns any value when we open the cursor.. There will not any SQLCODE because the Declare Cursor statement is not the executable statment...ONly if the OPen has any issue or if u r trying to fetch and that's got any issue u wuld be getting the SQLCODE +100 if all the rows had been fetched or if there is no result set also.. i hope this wud have made u clear.. if anymore queries pls get back to me...

Thanks & Regards,
V.Ram NArayan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group