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

DB2 Cursor and Sqlcode=100


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

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Thu Dec 11, 2008 3:01 pm
Reply with quote

Hi,


1) i am using a db2 cursor in the program and in first section i have opened the cursor , and then perfoming another section to fetch the records till sqlcode=100

The question is

2) when we open the cursor will it positioned to the first record which matches the condition
3 ) If the table is empty or no records matching the condition then will it throw the sqlcode 100 while opening the cursor.....

Please help me to find the solution.........


Thanks
Rohan
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Thu Dec 11, 2008 3:08 pm
Reply with quote

Quote:
when we open the cursor will it positioned to the first record which matches the condition

What do you mean by "which matches the condition"? Not exactly on first row while opening the cursor. But in first FETCH, the cursor will be on first row.

Quote:
3 ) If the table is empty or no records matching the condition then will it throw the sqlcode 100 while opening the cursor.....

No, while FETCHing only, SQLCODE 100 is thrown if there are no rows.
Back to top
View user's profile Send private message
rohanatl

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Thu Dec 11, 2008 3:24 pm
Reply with quote

HI thanks for ur replay

Quote:

when we open the cursor will it positioned to the first record which matches the condition



what I was suppposed to ask is ...we wil be having the select query in the cursor definition so if we open the cursor what actoin happens ..
i thought that if there is any records matches the condition in the query the cursor will
point to that particular record and then from there it will move to the next records based on the condition ...

Thanks
Rohan
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Thu Dec 11, 2008 3:35 pm
Reply with quote

Rohan,

www.ibmdatabasemag.com/db_area/archives/2000/q2/programmer.shtml

This might be a good info for you. It explains what happens on open and fetch.

Anyway, you cant get to know your cursor will return data or not, while Open!

Thanks,
Prajesh
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 SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
Search our Forums:

Back to Top