往Oracle 中导入数据时,有一个列导入的数据应该时‘2017-04-17’ 的格式,结果导入的数据为 ‘2017/04/17’格式的,1000多条记录要一条条改基本不可能。 于是想到了replace这个函数,具体用法如下:

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

 

replace 函数用法如下:

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

例:select  replace ('2017/04/17',2017/04/17','2017-04-17') from dual;

输出为 '2017-04-17'

相关文章:

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