Examine the following snippet of code from the DECLARE section of PL/SQL
DECLARE
Cust_name VERCHAR2 (20) NOT NULL : = ‘Tom Jones’:
Same_name cust_name%TYPE:
Which statement is correct about the above snippets of code?
A. The SAME_NAME variable inherits only the data type from the CUST_NAME variable.
B. The SAME_NAME variable inherits only the data type and default value from the CUST_NAME variable.
C. The SAME_NAME variable inherits the data type, constraint, and default value from the CUST_NAME variable.
D. The SAME_NAME variable inherits only the data type and constraint from the CUST_NAME variable resulting in an error
Agree with MDA
Additional reference:
https://docs.oracle.com/database/121/LNPLS/type_attribute.htm#LNPLS01352
“The referencing item inherits the following from the referenced item:
Data type and size
Constraints (unless the referenced item is a column)”
D is correct.
DECLARE
Cust_name VARCHAR2(20) NOT NULL := ‘Tom Jones’;
Same_name cust_name%TYPE;
BEGIN
null;
END;
/