Date of Birth validation
hello,
I am new to Oracle and am trying to valid the DOB. I only want person to be over 16years old. I tried using sysdate in the contraint but realise after reading around that system variables cannot be used and i have to use a trigger. Below was the constraint that i was trying (just so that you understand what i'm trying to do):
bq. ALTER TABLE tableName \\ ADD CONSTRAINT DOB_ck CHECK (dateofbirth IN ( dateofbirth < SysDate - 16 ));
How can I use a trigger or something else to ensure the DOB entered meets this condition?
Another problem that i have is that i want to ensure that the exam date entered is less than or equal to the SYSDATE (examDate <= SYSTDATE). Below is the constraint:
bq. ALTER TABLE tableName \\ ADD CONSTRAINT ExamDate_ck CHECK (ExamDate IN ( SysDate >= ExamDate))
How can I ensure that the date entered is past or present NOT future?
Any help would be much appreciated.
Thanks