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 field comparaison are traited as Varchar2 comparaison

Alexis BMay 23 2025

Hello everyone,

I have an apex page containing 2 Date picker fields P6_START_DATE and P6_END_DATE
Both have format mask set to DD/MM/YYYY
When page is submitted, a page process will check that P6_START_DATE is earlier than P6_END_DATE

IF :P6_START_DATE > :P6_END_DATE then

If :P6_START_DAT is 31/05/2025 and :P6_END_DATE is 01/06/2025
The condition is considered as TRUE and an error message is displayed

To fix this I needed to explicitely convert my date field to date, as below, and now it works :

IF to_date(:P6_START_DATE, 'DD/MM/YYYY') > to_date(:P6_END_DATE, 'DD/MM/YYYY') then

But I would like to understand if I did something wrong? Or is it an APEX Issue? Will I need to make the manual voncersion everytime I need a similar check ?

Thanks

Best regards,

This post has been answered by fac586 on May 23 2025
Jump to Answer
Comments
Post Details
Added on May 23 2025
4 comments
111 views