set serveroutput on

CREATE OR REPLACE TRIGGER Jaka_operacja
BEFORE INSERT OR UPDATE OR DELETE
ON emp
FOR EACH ROW
BEGIN
  IF INSERTING THEN
    DBMS_OUTPUT.Put_Line('wstawianie empno='||:NEW.empno);
  ELSIF UPDATING THEN
    DBMS_OUTPUT.Put_Line('zmienianie empno='||:NEW.empno);
  ELSIF DELETING THEN
    DBMS_OUTPUT.Put_Line('kasowanie empno='||:OLD.empno);
  END IF;
END;
/

INSERT INTO emp(empno, ename, job, sal, comm, deptno) VALUES(9000, 'LEON', 'CLEANER', '5000', '5000', 40);
UPDATE emp SET comm = 7500 WHERE empno = 9000;
DELETE FROM emp WHERE empno = 9000;

DROP TRIGGER Jaka_operacja;
