April 2024
Intermediate to advanced
127 pages
2h 29m
English
Cool! We’ve come to the final chapter before the project.
In this chapter, we are going to look at a major use of the LOOP statement that we learned in the previous chapter.
Specifically, we’ll be looking at cursors.
First off, what is a cursor?
A cursor is a mechanism that allows us to step through the rows returned by a SQL statement.
So far, we have been learning to use SELECT statements to retrieve information from our tables. These statements return all the rows that match the stated criteria. However, there is no way for us to step through the rows one at a time.
If we want to do that, we have to use cursors.
The syntax for declaring a cursor is:
DECLARE cursor_name CURSOR FOR ...
Read now
Unlock full access