What is the outcome when the above code is executed?

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/SQL block.
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 used in a PL/SQL block.

Download Printable PDF. VALID exam to help you PASS.

One thought on “What is the outcome when the above code is executed?

  1. Confirming that correct answer is A by executing above code in HR demo schema successfully:

    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);
    end;
    /

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.