PLSQL – Cursor Attributes

%ISOPEN :
Oracle engine automatically opens the SQL cursor for executing its associated select, insert, update or delete SQL statement and closes it after has been processed. The %ISOPEN attribute of an implicit cursor cannot be referenced outside of its SQL statement. Hence, SQL%ISOPEN always evaluates to false.

Syntax:

SQL%ISOPEN

%FOUND :
This evaluates to true if an insert, update or delete affects one or more rows, or a single-row select returns one or more rows. Otherwise, it evaluates to false. It returns NULL if the cursor is open, but fetch is not executed.

Syntax:

SQL%FOUND

%NOTFOUND :
This is the logical opposite of %FOUND. This evaluates to true, if an insert, update or delete affects no rows, or a single-row select returns no rows. Otherwise, it evaluates to false.

Syntax:

SQL%NOTFOUND

%ROWCOUNT :
This returns the number of rows affected by an insert, update or delete, or select into statement.

Syntax:

SQL%ROWCOUNT

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.