Examine this code:
CREATE OR REPLACE PROCEDURE set_bonus
(p_cutoff IN VARCHAR2 DEFAULT ‘WEEKLY’
p_employee_id IN employees_employee_id%TYPE
p_salary IN employees_salary%TYPE,
p_bonus_percent IN OUT NUMBER DEFAULT 1.5,
p_margin OUT NUMBER DEFAULT 2,
p_bonus_value OUT NUMBER)
IS
BEGIN
UPDATE emp_bonus
SET bonus_amount =(p_salary * p_bonus_percent)/p_margin WHERE employee_id = p_employee_id;
END set_bonus;
/
You execute the CREATE PROCEDURE statement above and notice that it fails.
What are two reasons why it fails? (Choose two)
A.
The syntax of the UPDATE statement is incorrect.
B.
You cannot update a table using a stored procedure.
C.
The format parameter p_bonus_value is declared but is not used anywhere.
D.
The formal parameter p_cutoff cannot have a DEFAULT clause.
E.
The declaration of the format parameter p_margin cannot have a DEFAULT clause.
F.
The declaration of the format parameter p_bonus_percent cannot have a DEFAULT clause.
Explanation:
You can’t assign a default value for the OUT and IN OUT parameters. Assigning a default value to an OUT or IN OUT parameter causes the following compilation error:
PLS-00230: OUT and IN OUT formal parameters may not have default expressions Incorrect AnswersA: There are no syntax errors on the Procedure.
B: Updates in a Stored Procedure are allowed and are quite common. C: This parameter has a default value and the fact that it is not being used in the Procedure will not cause an error.