This topic describes how to use the string function FROM_BASE64 in Realtime Compute.

Syntax

BINARY FROM_BASE64(str)

Input parameters

Parameter Data type Description
str VARCHAR The Base64-encoded string.

Description

Decodes a Base64-encoded string into BINARY data.

Example

  • Test data
    a (INT) b (BIGINT) c (VARCHAR)
    1 1L null
  • Test statements
    SELECT 
    from_base64(c) as var1,from_base64('SGVsbG8gd29ybGQ=') as var2 
    FROM T1; 
  • Test results
    var1 (BINARY) var2 (BINARY)
    null Byte Array: [72('H'), 101('e'), 108('l'), 108('l'), 111('o'), 32(' '), 119('w'), 111('o'), 114('r'), 108('l'), 100('d')]