Multiple choice

You are declaring a variable of data type NUMBER in a PL/SQL block. During the execution of the PL/SQL block, a query returns seven rows, and the next FETCH statement is issued. If the variable was assigned a value by using %ROWCOUNT attribute, which of the following values will be stored in it?

  1. 0

  2. 7

  3. 8

  4. NULL

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

%ROWCOUNT returns the number of rows fetched so far by the cursor. After a query returns 7 rows and a FETCH is issued, %ROWCOUNT will be 7. It starts at 0 before the first fetch and increments with each successful fetch.