您的位置:首页 > 数据库 > Oracle

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

2013-09-10 10:40 309 查看
关键字:replace,dbms_lob.instr

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

关键字:dbms_lob.instr

Code:

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


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

关键字:replace

Code:

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:

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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: