« 预防猪流感 - 一个都不能少 | Blog首页 | 北京恩墨科技有限公司 即日宣告成立 »
Oracle的to_date转换可能导致的错误SQL结果
作者:eygle | 【转载请注出处】|【云和恩墨 领先的zData数据库一体机 | zCloud PaaS云管平台 | SQM SQL审核平台 | ZDBM 数据库备份一体机】
链接:https://www.eygle.com/archives/2009/05/oracleto_datesq.html
David.Guo同学遇到了如下一个Bug,以前也遇到过,今个转录一下了。链接:https://www.eygle.com/archives/2009/05/oracleto_datesq.html
David的图说明了所有问题,看似毫无问题的一个查询出现了错误的结果:
其实可以看看执行计划的谓词转换,看看具体问题的出现原因。
Metalink上的Bug 4156916 - Dump / wrong results from TO_DATE without a full date format mask 可能与此有关。
这个BUG的内容记录是:
Description
Wrong results or dumps possible from queries having
predicates using TO_DATE (explicit or implicit) without
a full date format mask.
Workaround:
Set the following two events
event 38055 level 1 (disable redundant range predicate removal)
event 10078 level 1 (disable removal of constant predicates)
通过Event 38055 和 10078 可以实现Workaround。
这个Bug的影响范围和修复版本如下:Affects:
Product (Component) Oracle Server (Rdbms) Range of versions believed to be affected Versions < 10.2 Versions confirmed as being affected Platforms affected Generic (all / most platforms affected) Fixed:
This issue is fixed in
参考Metalink文档ID:4156916.8。
David的链接: http://www.oracledba.com.cn/blog/archives/463
By eygle on 2009-05-05 13:05 | Comments (5) | Case | 2274 |
这个转载图片,需要付费的哟:)
可以手机扣费么?
暂时不支持手机钱包
支持信用卡,储蓄卡,现金还有支付宝,你可以选一个了
什么场合会用到9999/mm/dd这种格式,为什么不是yyyy/mm/dd
楼上…… 你真幽默 :)