Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Data Types
 

Variables Based on Database Columns

You base a declaration on a table column without having to know definitively what that column's datatype is. Your variables will automatically be changed as the table column. You use the %type attribute in variable declarations to define variable based on table column. avg_rate    employee.pay_rate%type</th> dept_id     INTEGER;</td> sub_dept_id dept_id%type;  -- datatype based on a variable</td> area_id     dept_id%type := 9141; -- used with an initialization clause</td>