Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DB2 Cursor and Sqlcode=100

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: DB2 Cursor and Sqlcode=100
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: 788
Location: Chennai, India

PostPosted: Thu Dec 11, 2008 3:08 pm    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

Rohan,

http://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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us