The declaration section is required if any variables are to be used in a PL/SQL block. The declaration section also defines cursors, types, local procedures, and functions that are used in a block. If no variables or other elements need to be declared, then this section may be omitted.
Several different types of variables may be defined in a PL/SQL block. You can use simple, scalar variables to hold numeric, character string, and date values. You can declare record variables that allow you to manipulate several related values together. You can even declare in-memory tables and arrays.
The syntax for declaring a scalar variable is shown here:
variable_name type [CONSTANT] [NOT NULL] [:=initial_value]
Declares a variable explicitly.
variable_name [schema.] table_name.column_name%TYPE
Declares a variable by reference to an existing database column.
Declares a variable by reference to a previously defined PL/SQL variable.
Specifies the variable's name. A valid name may be up to 30 characters ...