Which three are valid calls to the add_dep procedure?

Examine this code:
CREATE OR REPLACE PRODECURE add_dept
(p_dept_name VARCHAR2 DEFAULT ‘placeholder’,
p_location VARCHAR2 DEFAULT ‘Boston’)
IS
BEGIN
INSERT INTO departments
VALUES (dept_id_seq.NEXTVAL, p_dept_name, p_location);
END add_dept;
/
Which three are valid calls to the add_dep procedure? (Choose three)

Examine this code:
CREATE OR REPLACE PRODECURE add_dept
(p_dept_name VARCHAR2 DEFAULT ‘placeholder’,
p_location VARCHAR2 DEFAULT ‘Boston’)
IS
BEGIN
INSERT INTO departments
VALUES (dept_id_seq.NEXTVAL, p_dept_name, p_location);
END add_dept;
/
Which three are valid calls to the add_dep procedure? (Choose three)

A.
add_dept;

B.
add_dept(‘Accounting’);

C.
add_dept(, ‘New York’);

D.
add_dept(p_location=>’New York’);

Explanation:
A is correct because both of the parameter have a default values. B is correct because here we
call the procedure using position notation, and the first parameter for the procedure will have the
value ‘Accounting ‘, and since the second parameter has a default value then we can skip it, and
in this case it will take the default value. D is correct because here we are calling the procedure
using naming notation, the value ‘ New York ‘ will go to the parameter p_location, and the
parameter p_dept_name will have the default value.
The following table list the for passing parameters to a procedure:
Incorrect Answer
C: You can’t use this way and assume that the PL/SQL will understand that he should assign the
default value for the first parameter. This is incorrect way for calling.



Leave a Reply 0

Your email address will not be published. Required fields are marked *