Salfii Salfii - 1 year ago 107
SQL Question

Oracle Insert Special Characters and Function Names

I´m currently struggling to insert a value into a varchar2 column off an Oracle Database. The value is (and full of special characters....):

'Data\QVD\QVD_'& replace(v_sc_val_ExecutionEnvironment, chr(39),'') &'\VTB_MOD1_RESULT\'

(Its a QlikView Formular which should be stored in the Database. Afterwards I can extract and evaluate it with QlikView, but I need the exact given format.)

I already tried to escape all ' with '' and so on, but It didn´t work so far. Define off didn´t work too.

I also found:
but didn´t find a solution there.

Hopefully someone had the same problems or knows the solution.

Thanks in advance!

Answer Source

Maybe you can try the q quote operator:

insert into yourTable(c)
values ( q'['Data\QVD\QVD_'& replace(v_sc_val_ExecutionEnvironment, chr(39),'') &'\VTB_MOD1_RESULT\']').

This way you should need no escape and the text should be inserted exactly as you typed it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download