Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Escaping special characters in RAW/BLOB

491733Aug 2 2007 — edited Aug 3 2007
Hi!

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2007
Added on Aug 2 2007
6 comments
1,298 views