MySQL/Oracle 更新或替换字符串字段中的部分内容

MySQL Oracle About 272 words

语法

UPDATE `table_name` SET `field_name` = REPLACE(`field_name`, 'from_str', 'to_str') WHERE `field_name` LIKE '%from_str%';

案例

去除字符串中的url链接

UPDATE `URL_LINK` set `content` = REPLACE(`content`, 'http://www.zhangbj.com/','') where `content` LIKE '%http://www.zhangbj.com/%'
Views: 4,041 · Posted: 2020-01-14

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh