Lesson 7 | Using parameters with cursors |
Objective | Identify correct syntax for using parameters with cursors. |
PL/SQL Cursor Parameters
Identify correct Syntax
You can specify parameters for cursors in a similar way that you define them for a procedure.
This allows you to pass parameters to a cursor when you open the cursor.
Look at the following Slideshow to see how the syntax works and learn how to open a cursor that uses parameters.
- Here is the syntax of a cursor containing parameters.
- Here is an example of a cursor that has two parameters.
- Continuing with the example, this screen shows you how to open the cursor while specifying values for the parameters.
- This screen shows how you can omit the last parameter if you desire.
Cursors With Parameters
The key reason for using parameters in a cursor is to help you write clear code. It is obvious to the casual reader of your code that you are passing variables X, Y, and Z to the cursor if the OPEN command contains those three variables as parameters.
The next lesson concludes this module.
Procedures/Functions Cursors Parameters - Quiz