從字符串中刪除不需要的字符

比如刪除‘abc’,三種方法

1.select str1,replace(translate(str1,'abc','eee'),'e'.' ') str
  from table;
2.select str1,translate(str1,'1abc','1') str
  from table;
3.使用更簡單的正則函數regexp_replace,直接把[]內列舉的字符替換爲空
  select str1,regexp_replace(str1,'[abc]') as str
  from table;


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