Is there any build-in inverse-function of HTF.ESCAPE_SC in Oracle SQL? Is there any build-in inverse-function of HTF.ESCAPE_SC in Oracle SQL? oracle oracle

Is there any build-in inverse-function of HTF.ESCAPE_SC in Oracle SQL?


I found the function: DBMS_XMLGEN.CONVERTI does encoding and decoding.

SELECT DBMS_XMLGEN.CONVERT('Please encode <this> tag', 1) FROM dual;Please encode <this> tagSELECT DBMS_XMLGEN.CONVERT('Please decode <this> tag', 0) FROM dual;Please decode <this> tag


I don't think there's a built in that does that. You could write a small function to prevent an unreadable stack of calls to replace().

create or replace function unescape_sc(p_str in varchar2)return varchar2is  l_str varchar2(2000) := p_str; -- adjust size as requiredbegin  l_str := replace(l_str, '&', '&');  l_str := replace(l_str, '>', '>');  l_str := replace(l_str, '<', '<');  l_str := replace(l_str, '"', '"');  return l_str;end unescape_sc;select unescape_sc('<parameter name="port">48677</parameter>')from dual;


I found this:

SELECT utl_i18n.unescape_reference ('<parameter name="port">48677</parameter>')FROM   dual

Output is:

<parameter name="port">48677</parameter>