April 19th, 2004, 05:41 AM
Hi all, can someone check my Trigger code... I never learn this stuff before... and I try to learn it...
Question: A student and his/her mentor cannot enrol in the same course (i.e. mentors and students they mentoring are not enrolled in the same course)
And I attached together the table pix...
CREATE OR REPLACE TRIGGER nevermentor
AFTER UPDATE OF STUDENT
DECLARE stdno STUDENT.STDNO%TYPE
FROM S STUDENT
WHERE S.STDNO = :NEW.MENTOR;
IF NEW.MENTOR =:S.STDNO
AND S.COURSECODE =:NEW.COURSE THEN
raise_application_error(-20012, 'Mentor and his/her student cannot enrol in the same course');