Posted - 09/10/2013 : 06:06:17
| Say for instance I have a table called STUDENTS.
This table will have columns named: Name, Gender, Birthday, Sex, and Year Level.
How do I use a trigger to ensure that the student is NOT above 50 years of age?
Is this right?
CREATE OR REPLACE TRIGGER student_age_constraint
FOR EACH ROW
IF (SELECT COUNT(*) FROM student WHERE birthday=ROUND((SYSDATE-NEW.birthday)/365, 2)) > 50
Raise_application_error(-30001, 'Invalid Attribute! Any student above the age of 50 is not accepted!');
Thanks in Advance!