对于年月日中"日"是个位的情况下,处理不一样,'yyyymmdd'格式没问题,而式'yyyy-mm-dd'格式则不行,请看:

SQL> alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';

Session altered.

SQL> select to_date('2007059','yyyy-mm-dd hh24:mi:ss') from dual;
select to_date('2007059','yyyy-mm-dd hh24:mi:ss') from dual
                 *
ERROR at line 1:
ORA-01861: literal does not match format string


SQL> select to_date('2007059','yyyy-mm-dd') from dual;
select to_date('2007059','yyyy-mm-dd') from dual
                 *
ERROR at line 1:
ORA-01861: literal does not match format string


SQL> select to_date('2007059','yyyymmdd')   from dual;

TO_DATE('2007059','

相关文章:

  • 2021-11-26
  • 2022-12-23
  • 2021-11-18
  • 2021-11-16
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-12-06
相关资源
相似解决方案