PL/SQL Parameters   «Prev  Next»

Lesson 7Using 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.

  1. Here is the syntax of a cursor containing parameters.
  2. Here is an example of a cursor that has two parameters.
  3. Continuing with the example, this screen shows you how to open the cursor while specifying values for the parameters.
  4. 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

Click the Quiz link below to answer a few questions about parameters in procedures, functions, and cursors.
Procedures/Functions Cursors Parameters - Quiz