Percent type: – The percent type used in PL/SQL for a column value when we declare PL/SQL variable to hold column value, we must insure that the variable is of current data type and precision. If it is not, a PL/SQL error will occur during execution.
Rather than hard coding the data type and precision of a variables, we can use % type attribute to declare a variable according to another previously declared variable or data base column. The percent type attribute is most offend used when the value stored in the variable will be derived from a table in the data base or if the variable is designed to be written to. To use the attribute in place of the data type required in the variable declaration, prefix it with the declaration table and column name. if referring to previously declare variable, prefix the variable name to the attribute. Syntax of the % type attribute –
<Variable Name> <Column Name> % type;