October 21st, 2003, 09:48 AM
I have oracle 8.1.7 and I'm trying to write a query that returns a 1 for valid data and a 0 for invalid data...
I have a birth date field that is invalid if it is null, less than 16 years ago, or greater than 100 years ago. Right now my query is...
How can I include the range delimination?
October 21st, 2003, 11:19 AM
Re: Decode questions
you can't really do conditional statements in a decode, however using a combination of subtraction and checking the sign of the result it can be accomplished. however it is tough to understand later, I would probably write a function instead.
October 22nd, 2003, 06:44 PM
The CASE expression is available in Oracle 8.1.7.
The following should do what you want:
CASE WHEN BirthDate IS NULL THEN NULL
WHEN BirthDate - 16*365 < SYSDATE THEN NULL
WHEN BirthDate - 100*365 > SYSDATE THEN NULL