In the following code, the variable surname inherits the data type, size, and NOT NULL constraint of the variable 'name'.
Because surname does not inherit the initial value of name, its declaration needs an initial value.
The value of surname cannot exceed 25 characters.
SQL> SQL> DECLARE-- w w w. j a v a 2s. c om 2 name VARCHAR(25) NOT NULL := 'value from name'; 3 surname name%TYPE := 'value from surname'; 4 BEGIN 5 DBMS_OUTPUT.PUT_LINE('name=' || name); 6 DBMS_OUTPUT.PUT_LINE('surname=' || surname); 7 END; 8 / name=value from name surname=value from surname PL/SQL procedure successfully completed. SQL>