gpt4 book ai didi

sql - 如何查找导致 ORA-01843 : not a valid month when the data volume is huge? 的记录

转载 作者:行者123 更新时间:2023-12-04 16:47:37 24 4
gpt4 key购买 nike

我无法将导致无效月份问题的记录清零,想知道是否有更简单的方法来查找导致问题的数据,而不是逐一手动检查所有内容?

编辑:

示例数据(以文本形式出现):

1/17/2019 12:00:00 AM

转换为时间戳:

to_timestamp(tested_date, 'MM/DD/YYYY HH:MI:SS AM')

最佳答案

从 Oracle 12.2 开始,您可以使用 validate_conversion() 来定位无效的日期字符串:

select tested_date
from mytable
where validate_conversion(tested_date as timestamp, 'MM/DD/YYYY HH:MI:SS AM') = 0

来自 the documentation :

VALIDATE_CONVERSION determines whether expr can be converted to the specified data type. If expr can be successfully converted, then this function returns 1; otherwise, this function returns 0.

关于sql - 如何查找导致 ORA-01843 : not a valid month when the data volume is huge? 的记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60605996/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com