%TYPE
: Used to declare a field with the same type as that of a specified table's column.
DECLARE
vEmployeeName Employee.Name%TYPE;
BEGIN
SELECT Name
INTO vEmployeeName
FROM Employee
WHERE RowNum = 1;
DBMS_OUTPUT.PUT_LINE(vEmployeeName);
END;
/
%ROWTYPE: Used to declare a record with the same types as found in the specified table, view or cursor (= multiple columns).
DECLARE
rEmployee Employee%ROWTYPE;
BEGIN
rEmployee.Name := 'Matt';
rEmployee.Age := 31;
DBMS_OUTPUT.PUT_LINE(rEmployee.Name);
DBMS_OUTPUT.PUT_LINE(rEmployee.Age);
END;
/