View the Exhibit and examine the structure of the employees table.
Examine the following block of code:
What is the outcome when the above code is executed?
A.
It executes successfully.
B.
It gives an error because decode cannot be used in a PL/SQLblock.
C.
It gives an error because the AVG function cannot be used in a PL/SQL block
D.
It gives an error because the MONTHS_BETWEEN function cannot be used in a PL/SQL block.
E.
It gives an error because both the AVG and decode functions cannot be usedin a PL/SQL
block.
A
a
A
A
declare
v_sal number;
v_name varchar2(30);
v_tenure NUMBER;
v_hire_date DATE;
BEGIN
SELECT AVG(salary) into v_sal from employees;
select hire_date,decode(salary,v_sal, last_name,’NA’)
into v_hire_date, v_name
from employees
where employee_id=195;
v_tenure:= months_between(current_date, v_hire_date);
dbms_output.put_line(v_tenure||’,’||v_name);
end;
A
A