PLSQL XML特殊字符轉換

---特殊字符轉換ide

  function process_xml(old_xml in varchar2) return varchar2 asregexp

    new_xml varchar2(1000);xml

  beginit

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

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

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

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

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

  

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

      INTO new_xml

      FROM dual;

  

    return new_xml;

  exception

    when others then

      return 'ERROR!';

  end process_xml;

相關文章
相關標籤/搜索