Converts a binary value into a Base64-encoded string.
Syntax
string base64(binary <value>)
Parameters
value: required. A value of the BINARY type. This parameter specifies the value that you want to convert.
Return value
A value of the STRING type is returned. If the input parameter is set to null, null is returned.
Examples
Example 1: Convert the binary result of
cast ('alibaba' as binary)
into a Base64-encoded string. Sample statement:-- The return value is YWxpYmFiYQ==. select base64(cast ('alibaba' as binary));
Example 2: The input parameter is set to null. Sample statement:
-- The return value is null. select base64(null);
Related functions
For more information, see Other functions.