sql操作oracle报错,date相关错误
发布日期:2021-05-08 12:13:23 浏览次数:20 分类:精选文章

本文共 767 字,大约阅读时间需要 2 分钟。

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

报错sql片段:

is not null and (to_date(字段名,'yyyy-MM-dd')+1) > sysdate

报错原因:数据库中存储有时分秒的数据识别不了

解决:修改sql片段为:is not null and (to_date(字段名,'yyyy-MM-dd HH:mm:ss')+1) > sysdate

-------------------------------------------------------------------------------------

修改后重新查询

报错信息:ORA-01810: format code appears twice

报错原因:Oracle中的日期格式是不区分大小写的,所以 mm 出现了两次

解决:修改sql片段为:is not null and (to_date(字段名,'yyyy-MM-dd HH:mi:ss')+1) > sysdate

-------------------------------------------------------------------------------------

修改后重新查询

报错信息:ORA-01849: hour must be between 1 and 12

报错原因:如果对Oracle语言设置设定为使用12小时的时间,这个问题就会在转换24小时的时间格式时发生。

解决:修改sql片段为:is not null and (to_date(字段名,'yyyy-MM-dd HH24:mi:ss')+1) > sysdate

上一篇:日志写入xml上传ftp遇到的问题
下一篇:使用多个tomcat如何修改端口号

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2025年04月18日 01时20分10秒