Lesson 23. Using Cursors
In this lesson, you’ll learn what cursors are and how to use them.
Understanding Cursors
As you have seen in previous lessons, Oracle retrieval operations work with sets of rows known as result sets. The rows returned are all the rows that match a SQL statement—zero or more of them. Using simple SELECT
statements, there is no way to get the first row, the next row, or the previous 10 rows, for example. Nor is there an easy way to process all rows, one at a time (as opposed to all of them in a batch).
Sometimes you need to step through rows forward or backward and one or more at a time. This is what cursors are used for. A cursor is a database query stored on the Oracle server—not a SELECT
statement, but the result set ...
Get Oracle PL/SQL in 10 Minutes, Sams Teach Yourself now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.