What is a cursor in Oracle?

Oracle use a work area for its internal processing to execute an SQL statement this work area is private to SQL's operation and is called a cursor.

Active Data Set: Data stored in the cursor. The size of the cursor in memory is the size required to hold the number of rows in the Active data set.

The value fetched from a table are held in a cursor opened in memory by the oracle engine. This data is then transferred to the client machine via the network. In order to hold this data, a cursor is opened at the client end.


Type of Cursors : Cursor is classified in 2 types.
  1. Implicit Cursor : Oracle Engine opened a cursor for its internal processing it is known as Implicit cursor
  2. Explicit Cursor : User defined cursor is known as an Explicit cursor. This cursor is opened for processing data through a PL/SQL block on demand.
Common Attributes of Cursor
Cursor control variables are also created to control the execution of the cursor. Following are a set of four system variables, which keep track of the Current status of a cursor. Cursor variables can be used and accessed in a PL/SQL code block.
Attribute Name Description
%ISOPEN Return True if cursor is open otherwise return false.
%FOUND Return True if record was fetched successfully otherwise return false.
%NOTFOUND Return True if record was not fetched successfully otherwise return false.
%ROWCOUNT Return number of records processed from the cursor.

Syntax
DECLARE
CURSOR IS
March 18, 2020 / by / 0 Comments

No comments:

Post a Comment

Thanks for your comments

Post Top Ad