juefeiye

需求是要修改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.主键列) , \'/\' , \'-\' )  解决了我们问题。

分类:

技术点:

相关文章:

  • 2022-02-05
  • 2021-09-17
  • 2022-12-23
  • 2021-09-17
  • 2022-01-18
  • 2021-09-23
  • 2021-09-17
猜你喜欢
  • 2021-09-17
  • 2021-07-22
  • 2021-09-18
  • 2021-06-11
  • 2021-08-23
  • 2021-09-17
  • 2021-05-29
相关资源
相似解决方案