Escaping special characters in RAW/BLOB
491733Aug 2 2007 — edited Aug 3 2007Hi!
I have a BLOB column that needs to be exported into a CSV Textfile. Sounds a bit scary but works fine when you escape the critical bytes.
I need to do the following replacement:
5C -> 5C 5C ( = \ )
22 -> 5C 22 ( = " )
00 -> 5C 30 ( = ?? )
0A -> 5C 0A ( = LF )
0D -> 5C 0D ( = CR )
If I use the replace function on my raw string, I can replace the bytes representing characters or numbers without a problem. " and \ also works fine but the nonprintable ones don't work - I guess implicit type conversion to varchar is the cause.
Anyway, I want to replace this stuff, but I couldn't find any native binary replace function. How can this be done? Do I have to write my own function? I fear byte by byte manipulation in PL/SQL on large data will not be very performing...
Thanks, Mac