Accessing Status Info by Using Cursor Variables : Cursor Status « Cursor « Oracle PL/SQL Tutorial






All cursors have properties that report their state of operation.

%FOUND checks whether a fetch succeeded in bringing a record into a variable.

%FOUND returns TRUE if the fetch succeeded, FALSE otherwise.

%NOTFOUND the reverse of %FOUND.

%NOTFOUND returns FALSE if the fetch succeeded, TRUE otherwise.

%ISOPEN checks whether a cursor is open.

%ROWCOUNT returns the number of rows processed by a cursor at the time the %ROWCOUNT statement is executed.

The variable %ROWCOUNT is a regular number variable.

The first three are Boolean variables that return a logical TRUE or FALSE.

If you use the %FOUND, %NOTFOUND, and %ROWCOUNT cursor variables before the cursor is opened or after the cursor is closed, they will raise an exception.

Values of %FOUND, %NOTFOUND, and %ROWCOUNT are changed after every fetch.

If there are no more rows to fetch, %ROWCOUNT keeps the number of successfully fetched records until the cursor is closed.

The variable properties of explicit cursors are referenced as

cursor_name%VARIABLE_NAME

c_employee%FOUND








25.7.Cursor Status
25.7.1.Accessing Status Info by Using Cursor Variables
25.7.2.Checking the status of explicit cursors
25.7.3.Checking the status of implicit cursors
25.7.4.To determine when the loop is to end, you can use the Boolean variable cursorName%NOTFOUND.
25.7.5.When cursorName%NOTFOUND
25.7.6.Return information using cursor status variables