PLSQL XML特殊字符转换

前端之家收集整理的这篇文章主要介绍了PLSQL XML特殊字符转换前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

---特殊字符转换@H_502_1@

function process_xml(old_xml in varchar2) return varchar2 as@H_502_1@

new_xml varchar2(1000);@H_502_1@

begin@H_502_1@

select replace(old_xml,'<','&lt;') into new_xml from dual;@H_502_1@

select replace(new_xml,'>','&gt;') into new_xml from dual;@H_502_1@

select replace(new_xml,'&','&amp;') into new_xml from dual;@H_502_1@

select replace(new_xml,'''','&apos;') into new_xml from dual;@H_502_1@

select replace(new_xml,'"','&quot;') into new_xml from dual;@H_502_1@

SELECT regexp_replace(new_xml,'^(\W)*|(\W)*$','')@H_502_1@

INTO new_xml@H_502_1@

FROM dual;@H_502_1@

return new_xml;@H_502_1@

exception@H_502_1@

when others then@H_502_1@

return 'ERROR!';@H_502_1@

end process_xml;@H_502_1@

猜你在找的XML相关文章