If a stored procedure is altered while it's currently being used in a cursor, does the cursor continue using the old query before it was altered?

dba.stackexchange https://dba.stackexchange.com/questions/253328

Question

If a stored procedure (or view) is currently in use within a long running cursor, and I alter that stored procedure, will the cursor continue using the old instance of the stored procedure until the cursor is finished?

Was it helpful?

Solution

So per @LowlyDBA's suggestion I decided to test this for myself (to a degree). I was actually in the middle of debugging a hot production issue so couldn't really stop to write out the code for a test case. But the code I'm debugging is this scenario. So I made my update to the procedure and looked at the running queries and saw the query text changed from before and after my change to the procedure as the cursor continued to iterate.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top