Skip to Main Content

APEX

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!

Date Validation

200334May 18 2005 — edited Jul 26 2007
I have a form with an optional date field (has a date picker format: MM/DD/YYYY)

How to I validate that the date entered is a valid date and a date in the future?

The first validation I entered was:
name: P1_DATENEEDED regular expression (MM/DD/YYYY)
type: regular expression
validation expression 1: P1_DATENEEDED
validation expression 2: ^(0?[[:digit:]]|1[012])[-/. ]?([012]?[[:digit:]]|3[01])[-/. ]?[[:digit:]]{4}$

I then added another validation
Name: Date needed needs must be > than today's date
Type: Function Returning Error Text
Validation Expression:
if (to_date(:P1_DATENEEDED,'MM/DD/YYYY') <= to_date(SYSDATE,'MM/DD/YYYY')) then
return 'Please enter a date in the future.';
else
return null;
end if;

It seems the 1st validation does catch the entry of 13/23/2004. But I am not catching that 01/01/2003 is not a future date.

After adding the 2nd validation I get the error message "Error ERR-1024 Unable to run "function body returning text" validation." ORA-01843: not a valid month when I entered the date of "04/02/2003"
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2007
Added on May 18 2005
3 comments
1,284 views