Declare scalars based on the datatype of a previously declared variable
SQL>
SQL>
SQL> --%TYPE attribute
SQL>
SQL> --Declare scalars based on the datatype of a previously declared variable.
SQL>
SQL>
SQL> DECLARE
2 x NUMBER(7,2) := 100;
3 y x%TYPE;
4 BEGIN
5 y := 200;
6
7 DBMS_OUTPUT.PUT_LINE(x);
8 DBMS_OUTPUT.PUT_LINE(y);
9 END;
10
11 /
100
200
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category