Using Cursors
In this chapter, I’ll explain the types of problems for which cursors are a reasonable solution, even though such cases are not common. The goal of the chapter is to show you how to use them wisely.
I’ll assume that you have sufficient technical knowledge of the various cursor types and know the syntax for declaring and using them. If you don’t, you can find a lot of information about cursors in Books Online. My focus is to explain why cursors are typically not the right choice and to present the cases in which cursors do make sense.
So why should you avoid using cursors for the most part?
For one, cursors conflict with the main premise of the relational model. Using cursors, you apply procedural logic rather than set-based logic. That ...
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