Hi all, can someone check my Trigger code... I never learn this stuff before... and I try to learn it...
Example,
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)
PHP Code:
CREATE OR REPLACE TRIGGER nevermentor
AFTER UPDATE OF STUDENT
DECLARE stdno STUDENT.STDNO%TYPE
BEGIN
SELECT S.STDNO
INTO stdno
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');
END IF;
END;
And I attached together the table pix...