Using Cursor Attributes:
Every cursor has 4 attributes: %NOTFOUND, %FOUND, %ISOPEN, and %ROWCOUNT.
If appended to the cursor name, they return the helpful information about the execution of the static and dynamic SQL statements.
To process the SQL data manipulation statements, the Oracle opens an implicit cursor named SQL. Its attributes returns information about the most newly executed INSERT, DELETE, UPDATE, or single-row SELECT statement. For illustration, the stand-alone function below uses %ROWCOUNT to return the number of rows deleted from the database table:
CREATE FUNCTION rows_deleted (
table_name IN VARCHAR2,
condition IN VARCHAR2) RETURN INTEGER AS
'DELETE FROM ' || table_name || ' WHERE ' || condition;
RETURN SQL%ROWCOUNT; -- return number of rows deleted
Similarly, if appended to a cursor variable name, the cursor attributes returns information about the execution of the multi-row query.