Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing a DYNAMIC cursor?

Status
Not open for further replies.

golyg

Programmer
Jul 22, 2002
319
US
In the following code,I open the dynamic cursor, but when my function is reiterating through this more than once, so I get a "cursor already open" error.
Can I close it like the last statement??
How do you close a Dynamic cursor??

Thanks alot,
---------------------------------------------------------

DECLARE cur_cursor DYNAMIC CURSOR FOR SQLSA;

//Declare Returned an Error
If SQLCA.SQLCode=-1 THEN GOTO SQLErr_Current
PREPARE SQLSA FROM :sg_Sql ;

//Prepare Returned an Error
If SQLCA.SQLCode=-1 THEN GOTO SQLErr_Current OPEN DYNAMIC cur_cursor;

//Open Cursor Returned an Error
If SQLCA.SQLCode=-1 THEN GOTO SQLErr_Current

FETCH cur_cursor INTO :in_CableTemp;

//Fetch Returned an Error
If SQLCA.SQLCode=-1 THEN GOTO SQLErr_Current

//I'm trying to close it here
CLOSE DYNAMIC cur_cursor;
 
This seems to have fixed it:

//code

//last statement:
CLOSE cur_cursor

this works, but as you know that doesn't mean its right.!
I hope its correct.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top