25. 7. 1. Accessing Status Info by Using Cursor Variables |
|
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
|
|