Tuesday, 22 May 2012

What are the different ways to determine the status of a cursor? | PL SQL

  The status of a cursor can be determined by checking the attributes of that cursor.
Following are the attributes of a cursor:
=>    %FOUND
=>    %NOTFOUND
=>    %ISOPEN
=>    %ROWCOUNT
The %FOUND, %NOTFOUND, and %ISOPEN attributes are of Boolean type, which means that they can have either the TRUE or FALSE value. As they are Boolean attributes, they can be accessed directly without explicitly comparing them to the TRUE or FALSE value, as shown in the following statement:
exit when cr__.first%NOTFOUND;
The preceding statement will cause any loop to exit when cr_first%NOTFOUND becomes TRUE.