Using Cursors in Recursive calls

  • im using a cursor in a stored procedure in which im calling itself i.e its recursive.

    i want to use a cursor such that evry time the SP calls itself a new cursor shuld be created and when it returns the cursor should be deallocated.

    is there a cursor property by which i can implement this.

    plz.......help

    viral

  • Before further advising, this looks like a bad way to do things. Can you explain the logic and detail of what you're trying to achieve?

  • When you declare your cursor there is a LOCAL option you can include which makes the cursor local to that stored procedure. For recursive procedures when there is no way around using cursors then this is what you would have to do.

  • Hi,

    One of the best pratices is not use CURSORS in procedures. try to check can your logic can be replaced with CTE's. i'm sure it should help u out

     

    Regards,

    Anand.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply