View previous topic :: View next topic
|
Author |
Message |
Narasimha_chintu
New User
Joined: 28 Aug 2005 Posts: 3
|
|
|
|
When we open cursor and process some statements and call other programs, sometimes the cursor may get closed even before closing the cursor explicitely.
If the cursor is closed, then we can open the cursor again.
For this, I would like to know whether we have any option to know the cursor is still opened OR closed i.e. the status of the cursor.
Note: I can not use the SQL-status-code to know wheter the cursor is opened or not. It is because I will process many SQL statements in between. So the SQL-status-code will show the status of last processed SQL statement. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
What condition is causing the cursor to close? There should be a way around this. Having to re-open and re-position youself in the cursor is pretty costly.
Dave |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Quote: |
For this, I would like to know whether we have any option to know the cursor is still opened OR closed i.e. the status of the cursor. |
I would could another OPEN CURSOR statement where you want to check & if getting -502 things are fine else if +000 It is opened again; rest all ABEND.
Quote: |
Note: I can not use the SQL-status-code to know wheter the cursor is opened or not. It is because I will process many SQL statements in between. So the SQL-status-code will show the status of last processed SQL statement. |
I dont understand this. Why cant you use SQLCODE. Number of times you are executing any SQL statement you'll get an SQLCODE. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Narasimha_chintu,
Come back and let us know if you have a resolution to your problem.
If not it could be as simple as adding 'WITH HOLD' to you Cursor.
Check the link below to the DB2 Manual
DECLARE CURSOR
Dave |
|
Back to top |
|
|
tanky
New User
Joined: 19 Jun 2006 Posts: 1
|
|
|
|
hEY
I Dont think is there any way get away from it |
|
Back to top |
|
|
|