BASE64ENCODE scalar function

The BASE64ENCODE function returns the Base64 encoded version of the binary values of a character string.

Read syntax diagramSkip visual syntax diagram BASE64ENCODE ( IN =>  character-string )
The schema is SYSTOOLS.
character-string
A character expression to be encoded. The maximum length in 2732 characters.

The result of the function is a varying length character string in CCSID 1208 that contains the bytes of character-string as a Base64-encoded string.

Example

  • Encode a string that contains the value X'1122334455'.
    VALUES SYSTOOLS.BASE64ENCODE(X'1122334455');
    The result is: ESIzRFU=.
  • Encode a character string in CCSID 37 that contains the value 'ABC'.
    VALUES SYSTOOLS.BASE64ENCODE('ABC');
    The result is: wcLD
  • Encode a UTF-8 string that contains the value 'ABC'.
    VALUES SYSTOOLS.BASE64ENCODE(CAST('ABC' AS VARCHAR(10) CCSID 1208));
    The result is: QUJD