Check out example codes for "the cursor is already open sql server". It will help you in understanding the concepts better.

Code Example 1

IF CURSOR_STATUS('global','myCursor')>=-1
BEGIN
 DEALLOCATE myCursor
END

Learn ReactJs, React Native from akashmittal.com