oracle 找出异常数据

需求缘由

sql执行成功,但是导出失败

执行语句

复制代码
select table_name, pk,time_o,op  from (
    SELECT 'FABCAP****BANK' as table_name,
        "SYSID"  as pk ,
        OCREATETIME AS time_o,
        'i' as op
    from FABCAPAB***BANK
    where to_date(substr(OCREATETIME,1,19),'yyyy-mm-dd hh24:mi:ss') >=to_date('2024-06-14 14:11:38','yyyy-mm-dd hh24:mi:ss')
    and to_date(substr(OCREATETIME,1,19),'yyyy-mm-dd hh24:mi:ss') <=to_date('2024-06-14 14:12:44','yyyy-mm-dd hh24:mi:ss')
    UNION all
    SELECT 'FABCA***ANK' as table_name,
        "SYSID" as pk,
        OUPDATETIME as time_o,
        'u' as op
    from FABCAP***BANK
    where to_date(substr(OUPDATETIME,1,19),'yyyy-mm-dd hh24:mi:ss') >=to_date('2024-06-14 14:11:38','yyyy-mm-dd hh24:mi:ss')
    and to_date(substr(OUPDATETIME,1,19),'yyyy-mm-dd hh24:mi:ss') <=to_date('2024-06-14 14:12:44','yyyy-mm-dd hh24:mi:ss')
     ) 
复制代码

 

错误提示

Oracle 异常 ORA-01861: literal does not match format string(字符串格式不匹配)

解决办法 搜索出异常数据

通过正则方式

select * from FABCAPABILITYBANK where NOT regexp_like(OCREATETIME,'^2024');

 

 

posted @   AlamZ  阅读(18)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2017-06-14 python 装饰器 (多个参数的函数,带参数的装饰器)
点击右上角即可分享
微信分享提示