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

关键字:dbms_lob.instr

Code:



select id, content from table_name where dbms_lob.instr(content,'/admin/ewebeditor/uploadfile/') > 0;


 

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

关键字:replace

Code:



select id, replace(st.content,'/admin/ewebeditor/uploadfile/','E:/resource/images/uploadfile/') 
from table_name where id = 553 and dbms_lob.instr(content,'/admin/ewebeditor/uploadfile/') > 0;


 

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

关键字:update set

Code:



update table_name set content = replace(content,'/admin/ewebeditor/uploadfile/','E:/resource/images/uploadfile/') 
where id = 553 and dbms_lob.instr(content,'/admin/ewebeditor/uploadfile/') > 0;