Cursor
By Amit Sharma(2202)
What is Cursor?
• Cursor is a Temporary Memory or Temporary
Work Station created in system memory.
• The oracle engine uses a work area for its
internal processing on order to execute an SQL
statement .
• The result data that is stored in the
cursor is called Active data set.
Types of Cursors.
➔ There are two types of Cursor
A) Implicit B) Explicit
➔ A) If the Oracle engine opened a cursor for its internal
processing it is known as an Implicit Cursor.
➔ B) A cursor can also be opened for processing data
through a PL/SQL block, on demand. Such a user
defined cursor is called Explicit Cursor.
Implict Cursor
➢ Definition: Implicit cursors are automatically created
And all process do by Oracle Engine.
➢ Usage: They handle single SQL operations, such as
INSERT, UPDATE, or DELETE.
➢ Accessing Data: You can use attributes like
%ROWCOUNT , %FOUND ,%NOTFOUND.
Explict Cursor
➢ Definition: Explicit cursors are user-defined Cursor,
Created And all process do by User.
➢ Usage: You declare an explicit cursor for a specific
SQL query and manage it using OPEN, FETCH, and
CLOSE statements.
➢ Accessing Data: You can use attributes like %ISOPEN
%ROWCOUNT , %FOUND ,%NOTFOUND.
How to use Explicit Cursor?
There are four steps in using an Explicit Cursor.
1. DECLARE the cursor in the Declaration section.
2. OPEN the cursor in the Execution Section.
3. FETCH the data from the cursor into PL/SQL
variables or records in the Execution Section.
4. CLOSE the cursor in the Execution Section
before you end the PL/SQL Block.
Thank
You