2010年4月12日月曜日

PostgreSQL / MySQL 文字列置換



文字列の置換方法(replace)


replace( 文字列 , '検索置換文字列', '置換後の文字列')




select replace('aabbcc', 'bb', 'BBBBB')

------- result -------

aaBBBBBcc






Updateでも使える




update
tableXXXX
set
col = replace( col , 'bb', 'BBBBB')
where
col = 'aabbcc'