How to escape special characters in scriptella

47 views
Skip to first unread message

Mario Tigua

unread,
Sep 21, 2018, 5:34:39 PM9/21/18
to Scriptella ETL

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 a string that must be concatenated.

Thanks in advance!

Christian MICHON

unread,
Sep 22, 2018, 2:32:18 AM9/22/18
to Scriptella ETL
Hi

You need to use a CDATA xml escape marker to enclose this sql request.

Good luck

Mario Tigua

unread,
Sep 24, 2018, 9:22:15 AM9/24/18
to Scriptella ETL
Thanks Christian!  I escaped the special characters and it works! 

var_xml := '&lt;CrearActualizarPaciente&gt;&lt;sinonimo&gt;'||$sinonimo||'&lt;/sinonimo&gt;&lt;/CrearActualizarPaciente&gt;'; 

Christian MICHON

unread,
Sep 24, 2018, 10:25:39 AM9/24/18
to Scriptella ETL
Good. But I meant this instead: enclose your full sql statement inside a CDATA, like this you do not need to escape individual special characters and keep your statement readable...


<![CDATA[

 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;
Reply all
Reply to author
Forward
0 new messages