PLSQL XML特殊字符转换

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

---特殊字符转换

function process_xml(old_xml in varchar2) return varchar2 as

new_xml varchar2(1000);

begin

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

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

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

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

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

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

INTO new_xml

FROM dual;

return new_xml;

exception

when others then

return 'ERROR!';

end process_xml;

原文链接:https://www.f2er.com/xml/294478.html

猜你在找的XML相关文章