CHAPTER 5 Next Please, One Row at a Time!
In our last episode, we left off with our "would-be" PL/SQL programmer trying to retrieve the first names of the Doe family members from table WORKER_T
using a singleton SELECT
. Little did our programmer know that Oracle has already solved this problem, and the magic required to pull off such a feat was already in his hands.
Cursors
And I don't mean the four-letter ones either! A cursor in this context is a named SQL SELECT
statement that you can use in your PL/SQL program to access multiple rows from a table, yet retrieve them one row at a time.
Cursor Declarations
You declare cursors in the declaration section of a PL/SQL block just as you declare functions, procedures, and variables. And you should ...
Get Beginning PL/SQL: From Novice to Professional 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.