0

How do i replace ampersand in a string with &?

DECLARE
l_string VARCHAR2(1000):='AB&CD';
BEGIN
    SELECT REPLACE(l_string,'&','&\amp;') INTO l_string FROM dual;
    DBMS_OUTPUT.PUT_LINE('l_string = ' || l_string);
END;
jarlh
  • 42,561
  • 8
  • 45
  • 63
PTK
  • 307
  • 4
  • 19

1 Answers1

1

encode

select dbms_xmlgen.convert('"ab&cd < ef"') from dual;

and decode

select dbms_xmlgen.convert('&quot;ab&amp;cd &lt; ef&quot;',1) from dual;
difr
  • 21
  • 3