Oracle Database 11g: Program with PL/SQL — Question 22

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?

Answer options

Correct answer: D

Explanation

The correct answer is D because the SAME_NAME variable inherits only the data type and constraint from CUST_NAME, but it does not inherit the default value, which results in an error when trying to use a NOT NULL constraint without a default. Options A and B are incorrect as they misrepresent the inheritance of properties, and option C incorrectly states that the default value is inherited.