I have the following string in Hex :
5B31E7C4931C2F62A4EB06573B3D4D4B7D96D2AAD05F9D626664CEB53023F1020F38B4399D98A2F280DC3606666B966A1B6878D2559044B2FC583FDFAB680714
I'm trying to convert it to Base64 using Oracle.
According to this calculator : https://base64.guru/converter/encode/hex the result should be
WzHnxJMcL2Kk6wZXOz1NS32W0qrQX51iZmTOtTAj8QIPOLQ5nZii8oDcNgZma5ZqG2h40lWQRLL8WD/fq2gHFA==
which is correct.
I tried the following computation but it doesn't return the correct value :
UTL_ENCODE.BASE64_ENCODE(HEXTORAW(Value))
Does anyone know how to achieve this in Oracle ?
Thanks. Cheers,
CodePudding user response:
UTL_ENCODE.BASE64_ENCODE returns a RAW. You want to turn it back to a string
utl_raw.cast_to_varchar2(UTL_ENCODE.BASE64_ENCODE('5B31E7C4931C2F62A4EB06573B3D4D4B7D96D2AAD05F9D626664CEB53023F1020F38B4399D98A2F280DC3606666B966A1B6878D2559044B2FC583FDFAB680714'))