Here is a bit of code to get you started for the assignment:
CREATE OR REPLACE TRIGGER CourseRegistration INSTEAD OF INSERT ON Registrations REFERENCING NEW AS new FOR EACH ROW DECLARE hasPassed Int; BEGIN SELECT COUNT (*) INTO hasPassed FROM PassedCourses WHERE course = :new.course AND student = :new.student; IF hasPassed > 0 THEN RAISE_APPLICATION_ERROR(-20001,'Student has already passed'); ELSE RAISE_APPLICATION_ERROR(-20002,'Student has not passed the course! This error is just a placeholder.'); END IF; END; /