更改PostgreSQL列字符串中的一个字符

时间:2016-07-01 14:07:24

标签: sql postgresql

我在描述栏中有数百个条目,如下所示:

CAP 0.001UF ±10% 50V X7R 0402 

我需要将其更改为:

CAP 0.001UF +/-10% 50V X7R 040

如何搜索记录并将±的所有实例更改为+/-

1 个答案:

答案 0 :(得分:0)

如何使用replace()和like

update t
    set description = replace(description, '±', '+/-')
    where description like '%±%';