PL/SQL %ROWTYPE Attribute

The %ROWTYPE attribute provides a record type that represents a row in a table. The record can store an entire row of data selected from the table or fetched from a cursor or cursor variable.

Syntax:

record_variable cursor_name%ROWTYPE;

Example:

declare
 cursor c1 is
  select lastname, departmentid
  from employee
  where departmentid = 33;
 v_rec c1%ROWTYPE;
begin
open c1;
loop
 fetch c1 INTO v_rec;
 exit when c1%NOTFOUND;
 DBMS_OUTPUT.PUT_LINE('Lastname: '||v_rec.lastname);
end loop; 
close c1; 
end;