Oracle TO_DATE NOT throwing error Oracle TO_DATE NOT throwing error oracle oracle

Oracle TO_DATE NOT throwing error


See the table here: https://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements004.htm#g195479

It is part of the String-To-Date Conversion Rules section of the Datetime format model. In the case of MM if there is no match, it attempts for MON and MONTH. Similarly if you specify MON and it does not find that, it attempts MONTH. If you specify MONTH and it cannot find that, it attempts MON, but it will never attempt MM on anything except MM.

In response to the question: Can I turn it off? The answer is, Yes.

You can do that by specifying FX as part of your formatting.

SELECT TO_DATE('18/february/2016', 'FXDD/MM/YYYY') FROM dual;

Now returns:

[Error] Execution (4: 16): ORA-01858: a non-numeric character was found where a numeric was expected

Whereas the following:

SELECT TO_DATE('18/02/2016', 'FXDD/MM/YYYY') FROM dual;

Returns the expected:

2/18/2016

Note that when specifying FX you MUST use the proper separators otherwise it will error.


This is by design. Oracle tries to find deterministic date representation in the string even if does not comply with the defined mask. It throws the error only it doesn't find deterministic date or some required component of the date is missing or not resolved.


I think a 02 could mean date/month/year anything, but feb would only mean one thing, a month.Also I crosschecked the same in 11g and got the same output as you got in 12c. So it has to be by oracle design.