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.

Explanation:



Leave a Reply 7

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


samkelo siyabonga ngubo

samkelo siyabonga ngubo

A

PIERO

PIERO

A
SAL IS GLOBAL TO THE ENTIRE BLOCK
AND FUNCTION AND PROC ARE DECLARED IN DECLARE SESSION

Sufiyan Shaikh

Sufiyan Shaikh

A is the right answer.

here is the code, dont get confused…copy it and verify it.

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 sufi_emp
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;

NOTE := PLAESE MAKE A COPY OF EMPLOYEE TABLE
( CREATE TABLE COPY_EMP AS SELECT * FROM EMPLOYEES) AND IMPLEMENT THE CODE ON NEW TABLE…yOU MIGHT BE GETTING ERROR WHILE COMPILING BECAUSE THERE MIGHT BE POSSIBILITY OF tRIGGER ON EMPLOYEES TABLE…sO MAKE SURE THERE ISNT ANY TRIGGER ON TABLE WHILE IMPLMENTING THE CODE…
I WILL SUGGEST YOU TO MAKE NEW TABLE OF YOURS AND IMPLEMENT THE CODE AS dID IN THE ABOVE CODE, SO THAT YOU WONT GET UNECESSARY ERRORS AND YOU GET CONFUSED.

FURTHER QUERIES email me at [email protected]

Thank You..

Nishdha

Nishdha

A is the correct answer, variable ‘SAL’ is global