Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. create or replace TRIGGER update_salary
  2. BEFORE UPDATE OF salaire_actuel ON professeurs FOR EACH ROW
  3.  
  4.  
  5. DECLARE
  6. TOO_MUCH EXCEPTION;
  7.  
  8. BEGIN
  9. DBMS_OUTPUT.PUT_LINE((:OLD.salaire_actuel * 0.2 + :OLD.salaire_actuel) || :NEW.salaire_actuel || USER);
  10. IF((:OLD.salaire_actuel * 0.2 + :OLD.salaire_actuel) < :NEW.salaire_actuel AND USER <> 'GRANDCHEF') THEN
  11. RAISE TOO_MUCH;
  12. END IF;
  13. EXCEPTION
  14. WHEN TOO_MUCH THEN
  15. RAISE_APPLICATION_ERROR (-20002, 'No modification is authorized');
  16. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement