Created
November 9, 2023 06:25
-
-
Save ciurca/2710acf6756e27d162dec9185c8ca795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Exercitiul 1 (Salariul Mediu) | |
DECLARE | |
v_functie angajati.job_id%TYPE:='SA_REP'; | |
v_salariu_mediu angajati.salary%TYPE; | |
BEGIN | |
SELECT AVG(salary) INTO v_salariu_mediu FROM ANGAJATI WHERE job_id=v_functie; | |
dbms_output.put_line(v_salariu_mediu); | |
END; |
Author
ciurca
commented
Nov 12, 2023
-- Exercitiul 10 (scadere salariala)
DECLARE
CURSOR c_reprezentanti IS
SELECT employee_id, salary FROM angajati
WHERE job_id='SA_REP' OR job_id='SA_MAN'
FOR UPDATE WAIT 5;
r_reprezentanti c_reprezentanti%ROWTYPE;
BEGIN
OPEN c_reprezentanti;
LOOP
FETCH c_reprezentanti INTO r_reprezentanti;
EXIT WHEN c_reprezentanti%notfound;
UPDATE angajati
SET salary = r_reprezentanti.salary - (r_reprezentanti.salary*5/100)
WHERE employee_id = r_reprezentanti.employee_id;
END LOOP;
COMMIT;
dbms_output.put_line('Nr. de personal a caror salarii au fost scazute cu 5%: ' || c_reprezentanti%ROWCOUNT);
CLOSE c_reprezentanti;
END;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment