ORA-01830错误

遇到这个错:ORA-01830: 日期格式图片在转换整个输入字符串之前结束

 

wrong:

select *
  from region_top rt, region r
 where rt.region_id = r.region_id
   and rt.stat_time >= to_date('2010-7-27 12:44:01', 'yyyy-mm-dd HH24:MI')
   and rt.stat_time <= to_date('2010-7-28 10:59:59', 'yyyy-mm-dd HH24:MI')

 

right:

select *
  from region_top rt, region r
 where rt.region_id = r.region_id
   and rt.stat_time >= to_date('2010-7-27 12:44', 'yyyy-mm-dd HH24:MI')
   and rt.stat_time <= to_date('2010-7-28 10:59', 'yyyy-mm-dd HH24:MI')
   
启示:   
SELECT TO_DATE('2007/04/01 13:30:01','YYYY-MM-DD') A FROM dual;
SELECT TO_DATE(SUBSTR('2007/04/01 13:30:01',1,10),'YYYY/MM/DD') B FROM dual;
SELECT SUBSTR('2007/04/01 13:30:01',1,10) FROM DUAL;

你可能感兴趣的:(ora)