Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET SERVEROUTPUT ON
- DECLARE
- cod_Dep DEPARTMENTS.DEPARTMENT_ID%TYPE;
- nam_dep departments.department_name%TYPE;
- CURSOR c1 IS SELECT d.Department_id, d.department_name, e.salary
- FROM DEPARTMENTS d join employees e
- ON d.DEPARTMENT_ID=e.DEPARTMENT_ID;
- salary employees.salary%TYPE;
- BEGIN
- salary :=0;
- cod_dep := 20;
- FOR i IN c1 LOOP
- IF cod_dep = i.department_id THEN
- salary := salary + i.salary;
- END IF;
- nam_dep := i.department_name;
- END LOOP;
- DBMS_OUTPUT.put_line('El departamento ' || nam_dep || ' de codigo: ' || cod_dep ||' tiene como suma de salario: ' || salary );
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement