- Categories:
String & binary functions (Encoding/Decoding)
TRY_BASE64_DECODE_STRING¶
A special version of BASE64_DECODE_STRING that returns a NULL value if an error occurs during decoding.
BASE64_DECODE_STRING and TRY_BASE64_DECODE_STRING are “reciprocal”
(or “converse”) functions of BASE64_ENCODE.
Syntax¶
Arguments¶
inputThe base64-encoded string to decode to a normal string.
alphabetA string consisting of up to three ASCII characters:
The first two characters in the string specify the last two characters (indexes 62 and 63) in the alphabet used to encode the input:
AtoZ(indexes 0-25).atoz(indexes 26-51).0to9(indexes 52-61).+and/(indexes 62, 63).
Defaults:
+and/The third character in the string specifies the character used for padding.
Default:
=
Returns¶
A string.
Usage notes¶
For more information about base64 format, see base64.
Examples¶
This shows how to use the function and demonstrates that
TRY_BASE64_DECODE_STRING is the converse of BASE64_ENCODE:
This shows a more realistic example:
Create a table and data:
Query the data using the
TRY_BASE64_DECODE_STRINGfunction: