Wednesday, February 24, 2016

PL/SQL block that computes the sum of the salary of all the employees working in the particular department

PL/SQL block

SET SERVEROUTPUT ON

DECLARE
sumSalary number; 
BEGIN
select sum(salary) into sumSalary
from employees
where department_id=&department_id;  
dbms_output.put_line('The sum of salary ->'||sumSalary); 
END;
/

Output:

No comments:

Post a Comment