您的位置:首页 > 其它

20. orcle中统计一个字符串中某个字符的长度

2014-12-29 15:45 337 查看
例子1:统计一个字符串中“,”的个数:

select lengthb(regexp_replace('[a,b,c,d,e,f]','[^,]',null)) as res from dual;

例子2:查询lborganization表中字段fdncode包含1个"."号的所有记录:
select * from lborganization a where lengthb(regexp_replace('['||a.fdncode||']','[^.]',null)) =1;

例子3:把lborganization表中字段fdncode包含4个"."号的所有记录中的grade改为4:

update lborganization a set a.grade = 4 where lengthb(regexp_replace('['||a.fdncode||']','[^.]',null)) =4;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐