Advanced Datatype |
Top Previous Next |
Advanced Datatype Declaration
%TYPE
At execution time Oracle will inspect Data Dictionary, locate datatype of customer table’s cust_name field and that will be the datatype for v_cust_name variable.
%ROWTYPE
%ROWTYPE does not translates into Progress very good. That is a set of variables, one for each column of a table. Their names are variable name, followed by a period and column name. For example, rec_cust.last_name.
FETCH cur_cust INTO rec_cust; This format automatically fetches all of the columns defined in the cursor cur_cust into all the appropriate variables in the %ROWTYPE variable rec_cust.
rec_cust.cust_number datatype is inherited from customer table’s cust_number datatype. rec_cust.full_name is the column alias of concatenated result of last_name and first_name columns. The datatype of rec_cust.full_name is determined by combining 2 datatypes. For ex, if last_name is VARCHAR2(20) and first_name is VARCHAR2(15) then rec_cust.full_name will be VARCHAR2(36). That is 20 + 15 + 1, note the coma.
|