BASE64_DECODE v18
Use the BASE64_DECODE function to translate a Base64 encoded string to the original value originally encoded by BASE64_ENCODE. The signature is:
BASE64_DECODE (<r> IN RAW)
This function returns a RAW value.
Parameters
r
r is the string that contains the Base64 encoded data to translate to RAW form.
Examples
Before executing the following example, invoke the command:
SET bytea_output = escape;
This command instructs the server to escape any non-printable characters and to display BYTEA or RAW values onscreen in readable form. For more information, see the Postgres core documentation.
https://www.postgresql.org/docs/current/static/datatype-binary.html
This example encodes and then decodes a string that contains the SQL abc. It uses BASE64_ENCODE for encoding and BASE64_DECODE for decoding.
edb=# SELECT UTL_ENCODE.BASE64_ENCODE(CAST ('abc' AS RAW));
Output
base64_encode --------------- YWJj (1 row)
edb=# SELECT UTL_ENCODE.BASE64_DECODE(CAST ('YWJj' AS RAW));
Output
base64_decode --------------- abc (1 row)
- On this page
- Parameters
- Examples