Finding rows that don't contain numeric data in Oracle

前端 未结 9 565
陌清茗
陌清茗 2020-12-09 17:00

I am trying to locate some problematic records in a very large Oracle table. The column should contain all numeric data even though it is a varchar2 column. I need to find

9条回答
  •  萌比男神i
    2020-12-09 17:08

    You can use this one check:

    create or replace function to_n(c varchar2) return number is
    begin return to_number(c);
    exception when others then return -123456;
    end;
    
    select id, n from t where to_n(n) = -123456;
    

提交回复
热议问题