What is cursor ? Explain various attributes of cursor.
Answers
Cursor Attributes. Every explicit cursor and cursor variable has four attributes: %FOUND , %ISOPEN %NOTFOUND , and %ROWCOUNT . ... Before the first fetch from an open cursor, cursor_name%FOUND returns NULL . Afterward, it returns TRUE if the last fetch returned a row, or FALSE if the last fetch failed to return a row.
type of cursor
A cursor is a temporary work area created in the system memory when a SQL statement is executed. A cursor contains information on a select statement and the rows of data accessed by it. ... There are two types of cursors in PL/SQL : Implicit cursors.
A cursor is a temporary work area created in the system memory when a SQL statement is executed. A cursor contains information on a select statement and the rows of data accessed by it. This temporary work area is used to store the data retrieved from the database, and manipulate this data. A cursor can hold more than one row, but can process only one row at a time. The set of rows the cursor holds is called the active set.
There are two types of cursors in PL/SQL :
Implicit cursors.
Explicit cursors.
Both implicit and explicit cursors have the same functionality, but they differ in the way they are accessed.
Cursor Attributes
Name Description
%FOUND Returns TRUE if record was fetched successfully, FALSE otherwise.
%NOTFOUND Returns TRUE if record was not fetched successfully, FALSE otherwise.
%ROWCOUNT Returns number of records fetched from cursor at that point in time.
%ISOPEN Returns TRUE if cursor is open, FALSE otherwise.