%ROWCOUNT attribute returns an integer showing the number of rows fetched so far from the specified cursor.
cursor_name is the name of the cursor for which
%ROWCOUNT returns the number of rows retrieved thus far. After the last row is retrieved,
%ROWCOUNT remains set to the total number of rows returned until the cursor is closed. At that point,
%ROWCOUNT throws an
INVALID_CURSOR exception if referenced.
%ROWCOUNT on a cursor before it's opened or after it's closed results in an
0 if it's referenced when the cursor is open but before the first
%ROWCOUNT also returns
0 after the first
FETCH when the result set has no rows to begin with.
This example uses
This procedure prints the total number of rows retrieved at the end of the employee list as follows: