0

How cursor is different from while loop. Execution wise which is faster and safe in case of failure.

Zero
  • 1
  • 2

1 Answers1

1

Cursor is kind of pointer variable to a table row, where you loop over the rows by using the loop. So, answering to your question which is faster, then i would say loop and cursor are two different things cursor is a variable and loop is a iterator, and without loop you can't use the cursor.

Also, i suggest if possible you can use recursive CTE, to perform the operation that you are doing via cursor.

Neet Singh
  • 167
  • 1
  • 9