Examine this code:
CREATE OR REPLACE FUNCTION gen_email_name
(p_first VARCHAR2, p_last VARCHAR2)
RETURN VARCHAR2
IS
v_email_name VARCHAR (19) ;
BEGIN
v_email_bame := SUBSTR(p_first, 1, 1) ||
SUBSRE(p_last, 1, 7) ||
RETURN v_email_name;
END
/
Which two statements are true?
A.
This function is invalid.
B.
This function can be used against any table.
C.
This function cannot be used in a SELECT statement.
D.
This function can be used only if the two parameters passed in are not bull values.
E.
This function will generate a string based on 2 character values passed into the function.
F.
This function can be used only on tables where there is a p_first and p_last column.
Explanation:
Answer D is a correct response. If any of the parameters passed in are null then the result will be null and the function will attempt to return a NULL value. Answer E This function concatenates the first character of the first name and the first seven characters
of the last name which are passed in as parameters
B and E.
D is wrong, this function works with null values.
I think the correct answers are BE.
D: By deleting the “only” keyword, it will become correct.
Correct answer is A and C if the code is:
v_email_bame := SUBSTR(p_first, 1, 1) ||
SUBSRE(p_last, 1, 7) ||
because of ||.
Else
Correct answer is B And E if the code is:
v_email_bame := SUBSTR(p_first, 1, 1) ||
SUBSRE(p_last, 1, 7)||;
because of ;
Tested.
B) and E), function can return null
BE