Введение в модель данных SQL



Пример 17.11


CREATE TRIGGER EMP_DISMISSION AFTER DELETE ON EMP

FOR EACH ROW

BEGIN ATOMIC

INSERT INTO EMP_DISMISSED

ROW (EMP.EMP_NO, EMP.EMP_NAME, EMP.DEPT_NO);

UPDATE DEPT SET

DEPT_EMP_NO = DEPT_EMP_NO - 1,

DEPT_TOTAL_SAL = DEPT_TOTAL_SAL - EMP_SAL

WHERE DEPT.DEPT_NO = EMP.DEPT_NO

END;




Содержание  Назад  Вперед