How to escape special characters in scriptella

184 views Asked by At

Please help!

I need to insert a xml string inside a varchar field in an oracle 8i legacy table.

The insert goes like this:

       insert into NUC_LEGACY_2_ANAC values (
         SEQ_NUC_LEGACY_2_ANAC.nextval, 
         $sinonimo, 
         'ADT', 
         'CREATE_PATIENT',
         '<CrearActualizarPaciente><sinonimo>'||$sinonimo||'</sinonimo></CrearActualizarPaciente>',
         sysdate,
         null,
         0,
         0,
         null
       );
       commit;

But scriptella gaves me this error:

Element type "CrearActualizarPaciente" must be declared. Element type "sinonimo" must be declared. The content of element type "script" must match "(include|dialect|onerror)"

I understand scriptella does not recognize the xml like and string that must be concatenated.

Thanks in advance!

1

There are 1 answers

0
davide baccherini On

try to replace

'<CrearActualizarPaciente><sinonimo>'||$sinonimo||'</sinonimo></CrearActualizarPaciente>',

with

  '&lt; CrearActualizarPaciente> &lt;sinonimo>'||$sinonimo||'&lt;/sinonimo> &lt;/CrearActualizarPaciente>',