Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
CURSOR with FOR READ ONLY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Susanta

Active User


Joined: 17 Nov 2009
Posts: 125
Location: India

PostPosted: Thu Nov 29, 2012 3:50 pm    Post subject: CURSOR with FOR READ ONLY
Reply with quote

Hi

I have a query.
If a DB2 cursor is declared with "FOR read only" and commit is performed in between the process, will it close the cursor.


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

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1544
Location: Andromeda Galaxy

PostPosted: Thu Nov 29, 2012 4:34 pm    Post subject:
Reply with quote

Is this a Interview question and what happen when you tried?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Thu Nov 29, 2012 5:04 pm    Post subject:
Reply with quote

Susanta,

Yes.

If the cursor is declared using WITH HOLD, it will not be closed during commit.

Thanks,
sushanth
Back to top
View user's profile Send private message
Susanta

Active User


Joined: 17 Nov 2009
Posts: 125
Location: India

PostPosted: Thu Nov 29, 2012 5:57 pm    Post subject:
Reply with quote

HI all,


I have seen a program already running fine in production , Which uses "FOR read only" in the cursor declaration. It also performs COMMIT each time it finishes processing 10,000 rows . But cursor not getting closed by the COMMIT.

I used to know for declare cursors we need to mention "WITH HOLD" if we want to perform COMMIT in between . thats why i got above doubt.

icon_sad.gif

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

Active User


Joined: 17 Nov 2009
Posts: 125
Location: India

PostPosted: Fri Nov 30, 2012 1:12 pm    Post subject: Reply to: CURSOR with FOR READ ONLY
Reply with quote

Apologies ..........

I dint observed earlier .. the declaration has "WITH HOLD" mentioned at the top.

Code:
EXEC SQL
   DECLARE MyCursor CURSOR WITH HOLD FOR
   SELECT......
   ..........
   ..........
   ..........
   FOR READ ONLY
END-EXEC
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 -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us