將字符和數字分離

1.可以使用正則表達式:

select regexp_replace(a,'[0-9]',' ') d,
       regexp_replace(a,'[^0-9]',' ') e
from table;

注:[0-9]一種表示方式,代表[0123456789],還可以寫成[[:digit:]];"^"表示否定


2.translate

select translate(a,'w0123456789','w') d,
       translate(a,'0123456789'||a,'0123456789') e
from table;



發佈了37 篇原創文章 · 獲贊 3 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章