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

2014-11-24 12:55:28 · 作者: · 浏览: 0
oracle替换clob里面的某个特定的字符串
关键字:replace,dbms_lob.instr
第一步:判断clob里面是有包含某个特定的字符串:假如是说“/admin/ewebeditor/uploadfile/“
关键字:dbms_lob.instr
Code:
[sql] 
select st.id,st.content  
from t_d_strategy st where   dbms_lob.instr(st.content,'/admin/ewebeditor/uploadfile/') > 0;  

第二步:用replace先替换下看是否是自己想要的结果
关键字:replace
Code:
[sql] 
select st.id,replace(st.content,'/admin/ewebeditor/uploadfile/','E:/resource/images/uploadfile/')   
from t_d_strategy st where  st.id = 553 and dbms_lob.instr(st.content,'/admin/ewebeditor/uploadfile/') > 0;  

第三步:替换,前面的两步ok,肯定错不了的
关键字:update set
Code:
[sql] 
update t_d_strategy st set st.content = replace(st.content,'/admin/ewebeditor/uploadfile/','E:/resource/images/uploadfile/')   
where  st.id = 553 and dbms_lob.instr(st.content,'/admin/ewebeditor/uploadfile/') > 0;