当前位置:数据库 > Oracle >>

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

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;  

 


CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,