View previous topic :: View next topic
|
Author |
Message |
Susanta
Active User
Joined: 17 Nov 2009 Posts: 126 Location: India
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Is this a Interview question and what happen when you tried? |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Susanta,
Yes.
If the cursor is declared using WITH HOLD, it will not be closed during commit.
Thanks,
sushanth |
|
Back to top |
|
|
Susanta
Active User
Joined: 17 Nov 2009 Posts: 126 Location: India
|
|
|
|
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.
Thanks |
|
Back to top |
|
|
Susanta
Active User
Joined: 17 Nov 2009 Posts: 126 Location: India
|
|
|
|
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 |
|
|
|