15.6. Summary
Cursors give us those memories of the old days — when we could address things row by row. Ahhh, it sounds so romantic with that "old days" kind of thought. WRONG! I'd stick to set operations any day if I thought I could get away with it.
The fact is that set operations can't do everything. Cursors are going to be the answer any time a solution must be done on a row-by-row basis. Notice that I used the word "must" in there, and that's the way you should think of it. Cursors are great of taking care of some problems that can't be solved for any other means.
That being said, remember to avoid cursor use wherever possible. Cursors are resource pigs and will almost always produce 100 times or worse negative performance impact. It is extremely tempting — especially if you come from the mainframe world or from a dBase background — to just keep thinking in that row-by-row method. Don't fall into that trap! Cursors are meant to be used only when no other options are available.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access