oracle 替换clob里面的某个特定的字符串

来源:互联网 发布:php邀请码生成算法 编辑:程序博客网 时间:2024/06/06 12:54

第一步:判断clob里面是有包含某个特定的字符串:假如是说“/admin/ewebeditor/uploadfile/“

关键字:dbms_lob.instr

Code:

[sql] view plain copy
 print?
  1. select st.id,st.content  
  2. from t_d_strategy st where   dbms_lob.instr(st.content,'/admin/ewebeditor/uploadfile/') > 0;  



第二步:用replace先替换下看是否是自己想要的结果

关键字:replace

Code:

[sql] view plain copy
 print?
  1. select st.id,replace(st.content,'/admin/ewebeditor/uploadfile/','E:/resource/images/uploadfile/')   
  2. from t_d_strategy st where  st.id = 553 and dbms_lob.instr(st.content,'/admin/ewebeditor/uploadfile/') > 0;  



第三步:替换,前面的两步ok,肯定错不了的

关键字:update set

Code:

[sql] view plain copy
 print?
  1. update t_d_strategy st set st.content = replace(st.content,'/admin/ewebeditor/uploadfile/','E:/resource/images/uploadfile/')   
  2. where  st.id = 553 and dbms_lob.instr(st.content,'/admin/ewebeditor/uploadfile/') > 0;  
From:http://blog.csdn.net/xb12369/article/details/11518883
0 0
原创粉丝点击