Oracle實現獲得字串中指定字元個數的方法

2021-06-06 16:25:36 字數 800 閱讀 5722

select  (length(csrq)-length(replace(csrq,'-',''))) from dual;

select t.*,to_number(substr(r.pointstr,instr(r.pointstr,',',-1,1)+1,length(r.pointstr)))/1000 as result

from res_serverinfo t, res_servicescope r

where is_number(t.maxresid) = 1

and t.maxresid = r.servicescope_id

and length(r.pointstr) > 23

and length(r.pointstr) < 28

and countcharinstring(r.pointstr,',')=2

union

select t.*,to_number(substr(r.pointstr,instr(r.pointstr,',',-1,1)+1,length(r.pointstr)))/1000 as result

from res_serverinfo t, res_servicescope r

where is_number(t.freeresid) = 1

and t.freeresid = r.servicescope_id

and length(r.pointstr) > 23

and length(r.pointstr) < 28

and countcharinstring(r.pointstr,',')=2

Oracle修改字串中指定字元

如將 修改為回車符 即回車換行 如下 修改zj sjd表中jyyj欄位中 為 chr 1314 update zj sjd set jyyj replace jyyj,chr 1314 where jyyj like 修改zj sjd表中jyyj欄位中 chr 1314 為 chr 13 updat...

獲得定長字串

c 中的字串是unicode編碼,length是unicode的char的個數。所以,假如乙個字串中中英文混雜,又想獲得乙個固定寬度的字串,就比較麻煩。單純轉換成位元組再擷取難免會碰到半個漢字的問題。下面實現了這樣的功能,返回固定位元組長度的字串,如果發生截斷,後面補充2個或者3個 根據截斷點的位置...

oracle求字段中指定字串出現個數

下面結果集中result欄位,分別求出 不考核 部分報送 未報送 出現的次數 sql實現 select length replace wm concat result 不考核 不考核 length wm concat result bkh,length replace wm concat resul...