欢迎投稿

今日深度:

Oracle判断值为非数字,Oracle判断值数字

Oracle判断值为非数字,Oracle判断值数字


select * from product_info t where t.contract_detailid is not null
and length(translate(t.contract_detailid,'-.0123456789'||t.contract_detailid,'-.0123456789'))<>length(t.contract_detailid) for update


oracle数据库中判断非数字并删除

创建测试表
create table test(col varchar2(100)); insert into test values ('123-1324');insert into test values ('34141回');insert into test values ('821648462()');
运行语句
select translate(col, '0' || translate(col, '#0123456789', '#'), '0') from test
结果



 

oracle判断某个字段的值是不是数字

判断一个字符型字段是否全部为数字组成,可以用translate函数或者正则表达式判断一个字符型字段是否为数值,对于10G可用正则表达式实现
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/3592.html NewsArticle Oracle判断值为非数字,Oracle判断值数字 select * from product_info t where t.contract_detailid is not nulland length(translate(t.contract_detailid,-.0123456789||t.contract_detailid,-.0123456789))length(t.contract_detailid) for u...
评论暂时关闭