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!

Incorrect behavior of TO_DATE in Oracle 19c DB with RRMMDD format mask?

R.PrenningerDec 17 2019 — edited Dec 17 2019

Starting from version 19c TO_DATE behaves differently with the format mask RRMMDD than in earlier versions. If a text with a 4-digit year is converted to a date for this format mask, TO_DATE returns the error "ORA-01843: not a valid month", but if I use the format mask DDMMRR, TO_DATE returns a valid date. If the year is between 2000 and 2012, the TO_DATE function also returns a date in 19c with the RRMMDD format mask.

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

SQL> select to_date('20191217','RRMMDD') from dual;

select to_date('20191217','RRMMDD') from dual

               *

ERROR at line 1:

ORA-01843: not a valid month

SQL> select to_date('17122019','DDMMRR') from dual;

TO_DATE(

--------

17.12.19

SQL> select to_date('20121217','RRMMDD') from dual;

TO_DATE(

--------

17.12.12

in 18c and previous versions both format masks return date values without errors:

Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

Version 18.6.0.0.0

SQL> select to_date('20191217','RRMMDD') from dual;

TO_DATE(

--------

17.12.19

SQL> select to_date('17122019','DDMMRR') from dual;

TO_DATE(

--------

17.12.19

SQL>

So, the Question is, is it a bug in 19c?

Comments
Post Details
Added on Dec 17 2019
7 comments
4,224 views