oracle截取字符串替换,oracle字符串操作:拼接、替换、截取、查找
‘拼接‘||‘字符串‘ as Str from student;
2、使用concat(param1,param2)函數實現:
select concat(‘拼接‘,‘字符串‘) as Str from student;
注:oracle的concat()方法只支持兩個參數,如果拼接多個參數,可以嵌套concat():
select concat(concat(‘拼接‘,‘字符串‘),‘ab‘) as Str from student;
二、截取字符串
SUBSTR(string,start_position,[length]),獲取子字符串
string:源字符串
start_position:開始位置
length:字符串的長度[可選]
1 substr("ABCDEFG", 0); //返回:ABCDEFG,截取所有字符2 substr("ABCDEFG", 2); //返回:CDEFG,截取從C開始之后所有字符3 substr("ABCDEFG", 0, 3); //返回:ABC,截取從A開始3個字符4 substr("ABCDEFG", 0, 100); //返回:ABCDEFG,100雖然超出預處理的字符串最長度,但不會影響返回結果,系統按預處理字符串最大數量返回。5 substr("ABCDEFG", -3); //返回:EFG,注意參數-3,為負值時表示從尾部開始算起,字符串排列位置不變。
三、查找字符串
INSTR(string,subString,position,ocurrence)查找字符串位置
string:源字符串
subString:要查找的子字符串
position:查找的開始位置
ocurrence:源字符串中第幾次出現的子字符串
select INSTR(‘CORPORATE FLOOR‘,‘OR‘, 3, 2) as loc from dual
四、替換字符串
replace(strSource, str1, str2) 將strSource中的str1替換成str2
strSource:源字符串
str1: 要替換的字符串
str2: 替換后的字符串
select ‘替換字符串‘ as oldStr, replace(‘替換字符串‘, ‘替換‘, ‘修改‘) as newStr from dual
注:該文章參考原版:https://www.cnblogs.com/smallrock/p/3507022.html
oracle字符串操作:拼接、替換、截取、查找
標簽:開始???color???enc???拼接???param???position???abc???roc???位置
本條技術文章來源于互聯網,如果無意侵犯您的權益請點擊此處反饋版權投訴 本文系統來源:http://www.cnblogs.com/hjwq/p/7930351.html
總結
以上是生活随笔為你收集整理的oracle截取字符串替换,oracle字符串操作:拼接、替换、截取、查找的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql时间段以后_mysql时间段查
- 下一篇: 用统计功能计算机计算js,js实现计算器