The pl/sql language allows the declartion of variables and constants,which can be used in the SQL commands conatained in the PL/SQL block.All the variables and constants used must be declared
VARIABLES
We can declare variables in the declaration section part and use elsewhere in the body of a pl/sql block .The following shows how to declare a variable.
EXAMPLE : age number(4);
A variable named age has benn declared with the with of 4 bytes.similarily we can declare of a boolean type
EXAMPLE:
done boolean;
CONSTANT:-> >
A constant is defined as that holds a value that is once declared, and does not change in the program. Its declaration specified its name, data type, and its value and also allocates storage for it. This declaration can also be imposed on the NOT NULL constraint.
variables attributes
1.%TYPE
2.%ROWTYPE
%TYPE=
The varaibles that deal with table coloumn should have a same datatype and the length of the column itself.%type attribute is used when declaring variables that refer to the database coloumn
DECLARE
ENO EMP.EMPNO%;--ENO of same datatype and width as empno pf emp table share emp.sal%type;
brgin
---------
end;