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.