Re: FREE (cursor)
Posted in 1997
The normal sequence of statements when using cursors with prepared statements is as follows: PREPARE statement_id (using an sql statement) DECLARE cursor_id FOR statment_id OPEN cursor_id LOOP FETCH cursor_id END LOOP CLOSE cursor_id FREE cursor_id FREE stateent_id When you close the cursor you will free resources aquired from the open as well as those accumulated from any fetches. When you free the cursor you will free resources aquired at the declare of the cursor. When you free the statment you free resources aquired from the prepare. The advantage will be in all cases will be more available resources (mostly memory). The key is to free up resources when you are finished with them. In almost all cases it pays off to keep it around if there is a possibility that the resource (i.e. cursor or statment) will be used again. Yes, if you free the statment you must re-prepare it. Preparing is the most expensive operation by the way. -Bill > > Hello, > > Could someone explain the advantages/disadvantages of issuing a CLOSE > cursor statement and then issuing a FREE cursor statement?. IF the cursor > has been prepared, will the FREE statement require it to be prepared > again? > > Thanks for any help! > > Keith Howard -- Bill Ennis Voice: 312-474-7516 SSA Fax: 312-474-7460 500 W. Madison email: ennis@ssax.com ennis@accesschicago.net