Chapter 10B – Managing Databases with Oracle Database
Page 10B-49
DBMS_OUTPUT.PUT_LINE
(‘********************************************************************’);
DBMS_OUTPUT.PUT_LINE (‘ ‘);
DBMS_OUTPUT.PUT_LINE
(‘ Trigger Insert_DEPARTMENT_EMPLOYEE’);
DBMS_OUTPUT.PUT_LINE (‘ ‘);
DBMS_OUTPUT.PUT_LINE
(‘********************************************************************’);
/* Add new Employee to EMPLOYEE as a member of the Department. */
INSERT INTO EMPLOYEE
(EmployeeNumber, LastName, FirstName, Department, EmailAddress)
VALUES(seqEID.NextVal, NewLastName, NewFirstName, NewDepartment,
NewEmail);
(‘********************************************************************’);
END IF;
END;
/
To test this trigger, use:
(1) To attempt adding a DEPARTMENT with a reassignment from an existing
DEPARTMENT with only one EMPLOYEE: