我无法将导致无效月份问题的记录清零,想知道是否有更简单的方法来查找导致问题的数据,而不是逐一手动检查所有内容?
编辑:
示例数据(以文本形式出现):
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 whetherexpr
can be converted to the specified data type. Ifexpr
can be successfully converted, then this function returns1
; otherwise, this function returns0
.
关于sql - 如何查找导致 ORA-01843 : not a valid month when the data volume is huge? 的记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60605996/