对于年月日中"日"是个位的情况下,处理不一样,‘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‘,‘
oracle中日期格式'yyyy-mm-dd'和'yyyymmdd'的区别
时间: 2024-10-10 23:28:38