title: ORA-31061: XDB error: special char to escaped char conversion failed
body: <p>I'm completely new to Oracle's XDB, trying to breakfix a code in production environment which i am completely new to. </p>
  
  <pre><code>SELECT  DBMS_LOB.SubStr(RTRIM (XMLAGG (XMLELEMENT (E,XMLATTRIBUTES (ntx.nttx_str || '|' AS "Seg")) ORDER BY ntx.ref_id, ntx.ntnb_input_dtm desc)
                                     .EXTRACT ('./E[not(@Seg = preceding-sibling::E/@Seg)]/@Seg').GetClobVal(),','),1000,1)
      FROM
         (SELECT umum.ref_id,
                 ntnb.ntnb_input_dtm,
                 DBMS_LOB.SubStr(RTRIM (XMLAGG (XMLELEMENT (E,XMLATTRIBUTES (nttx.nttx_text || '' AS "Seg")) ORDER BY nttx.nttx_seq_no asc)
                                     .EXTRACT ('./E[not(@Seg = preceding-sibling::E/@Seg)]/@Seg').GetClobVal(),','),500,1) AS nttx_str
          FROM umum_util_mgt umum,
               ntnb_note_base ntnb,
               nttx_note_text nttx
          WHERE ntnb.ntnb_id = umum.ntnb_id
            AND ntnb.ntnb_id = nttx.ntnb_id
            AND ntnb.ntnb_input_dtm = nttx.ntnb_input_dtm
            GROUP BY umum.ref_id, ntnb.ntnb_input_dtm
          ) ntx,
          php_mdx_auth_ext_tbl paex
          WHERE ntx.ref_id = paex.ref_id*
  </code></pre>
  
  <p>When i try to execute the above query, Oracle is returning the below error</p>
  
  <p><strong>ORA-31061: XDB error: special char to escaped char conversion failed.</strong></p>
  
  <p>This used to work in older version of Oracle, after moving to oracle 12c we are facing this issue.</p>