oracle in長度限制的解決方法,將列轉為行 但是字串又會有長度限制,所以參考方法二
方法一:
SELECT REGEXP_SUBSTR('17,20,23','[^,]+',1,LEVEL) AS STR FROM DUAL CONNECT BY LEVEL <= LENGTH('17,20,23')-LENGTH(REGEXP_REPLACE('17,20,23',',','')) + 1
這里還有一個函式:REGEXP_REPLACE
REGEXP_REPLACE(source_char, pattern [, replace_string [, position [, occurrence [, match_parameter ] ] ] ] )
source_char :需要進行處理的字串
pattern :進行匹配的正則運算式
replace_string :替換的字符
position :從第幾個字符開始正則運算式匹配,(默認為1)
occurrence :標識第幾個匹配組
方法二:
SELECT regexp_replace(Supplier, '[^0-9]') cc FROM (select '1' a1, '2' a2, '3' a3 from dual) T UNPIVOT(org_id FOR Supplier IN(a1,a2,a3)) P
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/248153.html
標籤:其他
上一篇:SQL基本陳述句——查詢
下一篇:運維大刀小練
