oracle substr、instr以及case when 的连用截取字符串以及替换(repace)的使用
来源:互联网 发布:一件代发软件 编辑:程序博客网 时间:2024/05/29 21:28
最近项目上使用到截取的字符串 后来发现经同事提醒 发现replace比较简单 则又换成了replace ,都给记录一下,以便帮助人;
如下,现需要将某个字段的-本部 给截取掉:
1. substr、case when、instr等函数 连用:
substr(oc.fname_l2,0,case when instr(oc.fname_l2,'-本部')>0 then instr(oc.fname_l2,'-本部')-1 else length(oc.fname_l2) end) as bankcompanyname
2.
replace这个函数,具体用法如下:
update 表1 t set t.列1=replace((select 列1from 表1 a where a.主键列=t.主键列) , '/' , '-' ) 解决了我们问题。
replace 函数用法如下:
replace('将要更改的字符串','被替换掉的字符串','替换字符串')
例:select replace ('111222333444','222','888') from dual;
输出为 '111888333444'
0 0
- oracle substr、instr以及case when 的连用截取字符串以及替换(repace)的使用
- 数据库字符串截取函数substr、substring以及 case when函数使用
- oracle 截取字符(substr),检索字符位置(instr) case when then else end语句使用
- oracle 截取字符(substr),检索字符位置(instr) case when then else end语句使用
- oracle中实现截取字符串(substr)、查找字符串位置(instr)、替换字符串(replace)
- oracle中实现截取字符串(substr)、查找字符串位置(instr)、替换字符串(replace)
- oracle中实现截取字符串(substr)、查找字符串位置(instr)、替换字符串(replace)
- oracle中实现截取字符串(substr)、查找字符串位置(instr)、替换字符串(replace)
- Oracle的SUBSTR()和INSTR()以及REGEXP_SUBSTR()函数的用法
- Oracle截取字符串substr、查找字符串位置instr、替换字符串replace
- Oracle 通过Substr和Instr实现制定字符的字符串的截取
- Oracle中通过substr和instr实现截取指定字符之间的字符串:
- Oracle中通过substr和instr实现截取指定字符之间的字符串:
- Oracle中通过substr和instr实现截取指定字符之间的字符串:
- Oracle中通过substr和instr实现截取指定字符之间的字符串:
- oracle中subStr()和inStr()的使用
- oracle substr,substrb ,instr,instrb函数的用法以及like的优化
- oracle substr,substrb ,instr,instrb函数的用法以及like的优化
- fat16和fat32文件系统学习
- hdu 3790 最短路
- 物理内存与虚拟内存
- android 监听Home键和亮灭屏
- js创建Studio2.x动画
- oracle substr、instr以及case when 的连用截取字符串以及替换(repace)的使用
- ganglia 报 "Error 1 sending the modular data for" Error解决方法
- 强烈推荐一个pomelo程序设计伴侣
- Unable to run mksdcard SDK tool
- cin输入错误时导致failbit为1时的缓冲区分析。
- 查找中的性能调优策略
- 数据结构时间复杂度
- LeetCode题解:Search a 2D Matrix
- c# mdi子窗体简单教程