在oracle中,select语句查询字段中非纯数字值
时间:2021-07-01 10:21:17
帮助过:213人阅读
1.正则判断,适用于10g以上版本
--非正整数
select 字段
from 表
where regexp_replace(字段,
‘\d‘,
‘‘)
is not null;
--非数值类型
select 字段
from 表
where regexp_replace(字段,
‘^[-\+]?\d+(\.\d+)?$‘,
‘‘)
is not null;
--2.自定义函数,判断非值类型
create or replace function isnumber(col
varchar2)
return <a href
="https:
//www.baidu.com
/s?wd
=integer&tn
=44039180_cpr
&fenlei
=mv6quAkxTZn0IZRqIHckPjm4nH00T1YdmWndnynknWfzrjDYuHF90ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy
-bIi4WUvYETgN
-TLwGUv3EPjDvPjDYPHDs" target
="_blank" class
="baidu
-highlight"
>integer</a
> is
i number;
begin
i := to_number(col);
return 1;
exception
when others
then
return 0;
end;
select 字段
from 表
where isnumber(字段)
=0;
出处:https://zhidao.baidu.com/question/416414510.html
在oracle中,select语句查询字段中非纯数字值
标签:函数 ref select class regex article into question sel