SHARE
TWEET

Lab 4 BD2

a guest Oct 21st, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SET serveroutput ON;
  2. DECLARE
  3.     sal_max emp.sal%TYPE;
  4.     avg_venit emp.sal%TYPE;
  5.     CURSOR c_angajati IS SELECT ename, job, sal, comm, deptno FROM emp;
  6.     angajati c_angajati%ROWTYPE;
  7. BEGIN
  8.     FOR angajat IN c_angajati
  9.     LOOP
  10.         SELECT MAX(sal) INTO sal_max FROM emp
  11.             WHERE deptno = angajat.deptno;
  12.         SELECT AVG(sal + NVL(comm, 0)) INTO avg_venit FROM emp
  13.             WHERE job = angajat.job;
  14.            
  15.         IF (angajat.sal = sal_max) THEN
  16.             DBMS_OUTPUT.put_line('Salariu maxim ' || angajat.ename || ' '
  17.                 || angajat.sal || ' ' || angajat.deptno);
  18.         ELSIF (angajat.sal > avg_venit * 1.15) THEN
  19.             DBMS_OUTPUT.put_line('Venit mediu ' || angajat.ename || ' '
  20.                 || angajat.sal || ' ' || angajat.deptno);
  21.         END IF;
  22.     END LOOP;
  23. END;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top