Oracle replace函数使用

需求是要修改Oracle某列表中把这一列中全部的100换成200;

update b_nodes a set a.childs=replace((select childs from b_nodes b where b.nodeid=a.nodeid),'100','200') where a.childs>10005

以下为转载http://www.cnblogs.com/BetterWF/archive/2011/12/21/2295937.html谢谢

replace 函数用法如下:

replace('将要更改的字符串','被替换掉的字符串','替换字符串')

例:select  replace ('111222333444','222','888') from dual;

输出为 '111888333444'

今天往Oracle 中导入数据时,有一个列导入的数据应该时‘2011-10-11’ 的格式,结果导入的数据为 ‘2011/10/11’格式的,5000多条记录要一条条改基本不可能。 后来想到了replace这个函数,具体用法如下:

update 表1 t set t.列1=replace((select 列1from 表1 a where a.主键列=t.主键列) , '/' , '-' )  解决了我们问题。

原文地址:https://www.cnblogs.com/juefeiye/p/4015194.html