Using Explicit Cursors  «Prev  Next»

Lesson 8 Building a Cursor Block
ObjectiveDescribe how to Build a Cursor Block

Building Cursor Block

In this lesson, you will build a cursor block by using the concepts that you have learned so far.
Follow these steps to build a cursor block:
  1. Define a cursor.
  2. Open the cursor.
  3. Repeatedly fetch the data to process it.
  4. Close the cursor.

In the following Slide Show, the cursor block
  1. selects the product name and its inventory count from the product table,
  2. opens the cursor,
  3. fetches records into the cursor,
  4. displays the information, then
  5. closes the cursor.

1) Cursor Block 1 2) Cursor Block 2 3) Cursor Block 3 4) Cursor Block 4

Program 1 Program 2 Program 2 Program 2
Build Cursor Block
Now you have learned about the basic structure of a cursor block and how to build one, how to open a cursor, how to fetch the records, and how to close the cursor.
In the next lesson, we will look at the cursor FOR loop, an alternate way to write cursor blocks.

Build Cursor Block Steps

Click the Exercise link below to build a cursor block by using an evaluative simulation.
Build Cursor Block Steps

Ad Oracle PL/SQL Programming