BASE64_ENCODE v11
Use the BASE64_ENCODE
function to translate and encode a string in Base64 format (as described in RFC 4648). This function can be useful when composing MIME
email that you intend to send using the UTL_SMTP
package. The BASE64_ENCODE
function has two signatures:
and
This function returns a RAW
value or an OID
.
Parameters
r
r
specifies the RAW
string that will be translated to Base64.
loid
loid
specifies the object ID of a large object that will be translated to Base64.
Examples
Before executing the following example, invoke the command:
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, refer to the Postgres Core Documentation available at:
https://www.postgresql.org/docs/11/static/datatype-binary.html
The following example first encodes (using BASE64_ENCODE
), and then decodes (using BASE64_DECODE
) a string that contains the text abc: