Multiple choice technology databases

Declare Cursor c is select * from emp; I emp%row_type; Begin open c; fetch c into I; loop Dbms_output_line(‘Emp name:’ || i.ename); fetch c into I; exit when c%notfound; End loop; End; What is the error in above PL/SQL Block

  1. Close cursor statement is not included

  2. No exception block present

  3. exit when c%notfound; this should have been given as exit when c%not_found;

  4. I emp%row_type; it should be given as %ROWTYPE

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

The correct attribute for declaring a row variable that matches a table structure is %ROWTYPE (all caps), not %row_type. Option D correctly identifies this syntax error. The cursor attributes %NOTFOUND, %ISOPEN, and %ROWCOUNT are all spelled correctly, so option C is wrong.