Start of change

BASE64_ENCODE

The BASE64_ENCODE scalar function returns the Base64 encoded version of a binary value.

Read syntax diagramSkip visual syntax diagramBASE64_ENCODE(binary-string )
binary-string
An expression that returns a built-in binary string to be encoded.

The result of the function is a CLOB in CCSID 1208 that contains the bytes of binary-string as a Base64-encoded string.

Examples

  • Encode a string that contains the value X'1122334455'.
    VALUES QSYS2.BASE64_ENCODE(X'1122334455');
    The result is: ESIzRFU=.
  • Encode a character string that contains the EBCDIC value 'ABC'.
    VALUES QSYS2.BASE64_ENCODE('ABC');
    The result is: wcLD
  • Encode a UTF-8 string that contains the value 'ABC'.
    VALUES QSYS2.BASE64_ENCODE(CAST('ABC' AS VARCHAR(10) CCSID 1208));
    The result is: QUJD
End of change