[an error occurred while processing this directive]

More trigger hints

The code fragments given here are incomplete and some vital parts are missing (on purpose!). However, if you're stuck you might find it useful to study these code fragments.


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 course! This should not be an actual error...');
   END IF;
END;

Trigger compilation errors

If your trigger is "created with compilation errors", you can get additional information about the errors by typing:

    SHOW ERRORS;

See Ullman's notes on displaying trigger definition errors.


Last Modified: 7 December 2015 by Jonas DuregÄrd