Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create constraint to check age based on DOB

1030605Aug 4 2013 — edited Aug 4 2013

Hello,

In creating my database (using Oracle 11g Express), specifically my employee table, is there a way to create a constraint to ensure that the employee is equal to, or older than, 18 years old?

I do not want to ask people their age. I'd like to do it based off their DOB (as below). E.G. - The 'DOB' value listed in the below table.

Thanks for your help!

CREATE TABLE EMPLOYEE

(EmpNo NUMBER(6) PRIMARY KEY,

DOB DATE,

HireDate DATE DEFAULT GETDATE());

This post has been answered by Solomon Yakobson on Aug 4 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 1 2013
Added on Aug 4 2013
7 comments
5,323 views