What would be the outcome when the code is executed?

View Exhibit1 and examine the structure of the employees table.

View Exhibit2 and examine the code.

What would be the outcome when the code is executed?

View Exhibit1 and examine the structure of the employees table.

View Exhibit2 and examine the code.

What would be the outcome when the code is executed?

A.
It executes successfully.

B.
It gives an error because the SAL variable is not visible in the increase function.

C.
It gives an error because the increase function cannot be called from the RAISE_SALARY
procedure.

D.
It gives an error because the increase function and the RAISE_SALARY procedure should be
declared at the beginning of the declare section before all the other declarations.



Leave a Reply 9

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


Jen

Jen

DECLARE
emp_num NUMBER(6) :=120;
sal NUMBER;
inc_amt NUMBER;
FUNCTION increase (emp_num NUMBER)
RETURN number IS
inc_amt NUMBER;
BEGIN
SELECT salary INTO sal from employees where employee_id=emp_num;
inc_amt := sal * .10;
RETURN inc_amt;
END;
BEGIN
null;
END;

PL/SQL procedure successfully completed.

alex

alex

DECLARE
emp_num NUMBER(6) := 120;
sal NUMBER;
FUNCTION increase(
emp_num NUMBER)
RETURN NUMBER
IS
inc_amt NUMBER;
BEGIN
SELECT salary INTO sal FROM employees WHERE employee_id = emp_num;
inc_amt := sal * .10;
RETURN inc_amt;
END;
PROCEDURE raise_salary(
emp_id NUMBER)
IS
amt NUMBER;
BEGIN
amt := increase (emp_num);
UPDATE employees SET salary = salary + amt WHERE employee_id = emp_id;
END raise_salary;
BEGIN
raise_salary(emp_num);
COMMIT;
END;
/