Oracle has a function for encoding a binary value, specifically a RAW
type, into base64: BASE64_ENCODE
. This makes sense. I want to turn binary into something I can more easily port across systems.
However, in addition to accepting a binary RAW
for its input, it also returns a binary RAW
for its output. I find this extremely confusing, as the purpose of base64 is to encode the bytes in a text format.
So what does this output RAW
actually contain? What is the proper way to convert it into an actual text type (e.g., VARCHAR2
)?
I additionally assume that BASE64_DECODE
expects its input to be in the same format as the output of BASE64_ENCODE
, but please note if that’s not the case.
I’m specifically using Oracle 11.2, but I doubt this has changed since it was introduced. Feel free to correct my if I’m wrong on that.