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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scope of Cursors in Stored Procedures 1

Status
Not open for further replies.

gradley

Programmer
Feb 24, 2004
335
US
I ran into a situation this morning that I didn't know was possible. I executed a stored procedure which contained cursor processing. During the process, I trapped for a situation and exited the stored procedure without closing and deallocating the cursor.

When I called the stored procedure a second time, I received a "A cursor with the name curEmployeeFK already exists" message.

My previous assumption was that everything in Stored Procedures was local to the procedure. Can anyone shed some light on why this happens?

 
dont know why it happens but my understanding was that nothing except a close and deallocate command will end a cursor.

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
Furthermore - when you close a cursor it still remains available for use by issuing an open command - it is only when it is deallocated that it becomes unavailable.

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top