您的位置:首页 > 数据库 > Oracle

oracle中date错误,ORA-01830: date format picture ends before converting entire input string

2016-08-30 14:36 1611 查看
select "TO_DATE"('2016/08/11 00:00:00', 'yyyy/mm/dd') from dual

报错ORA-01830: date format picture ends before converting entire input string

错误产生原因:date类型不能包含秒以后的精度。

如日期:2012-06-20 21:01:24

在使用to_date() 函数时有可能出现此错误

解决办法:

to_date('2012-06-20 21:01:24','yyyy-mm-dd') 是错误的

使用instr(详细用法 http://www.cnblogs.com/BetterWF/archive/2012/06/20/2556444.html) 函数配合使用,例如:

to_date( substr('2012-1-1 00:00:00',0,INSTR('2012-1-1 00:00:00', ':', 1, 1)-3),'yyyy-mm-dd') 是正确的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐