You can do this in Oracle or in Perl.  If you do it in Perl with the
date_of_birth value being passed in then I would recommend using the
date:calc module.  If you are doing it in Oracle then something akin to:

select name, date_of_birth from data
where sysdate - date_of_birth > 21 * 365;

This is rough as I'm not feeling too well at the moment, but it should put
you on the right track for your final answer.  I'd personally recommend
using date:calc to get today's date and then subtract 21 years and then do a
delta_days against the birthday.  


-----Original Message-----
From: steve silvers [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 2:31 PM
To: [EMAIL PROTECTED]
Subject: Oracle SQL Statement help


Im using DBI to connect to a Oracle database and i'm having trouble with 
this:

In a nut shell. I have a table called DATA, and a column called 
DATE_OF_BIRTH.

I need to see if the person is under 21 years old. So I need to compare the 
"DATE_OF_BIRTH" with whatever the current date is. I have tried something 
like.

SELECT DATEDIFF(DATE_OF_BIRTH,SYSDATE) ... But no luck.

Does anyone know how to do this against Oracle?

Thanks in advance.
Steve.



_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to