UUENCODE v12
Use the UUENCODE
function to translate RAW
data into a uuencode formatted encoded string. The signature is:
UUENCODE(<r> IN RAW, <type> IN INTEGER DEFAULT 1, <filename> IN VARCHAR2 DEFAULT NULL, <permission> IN VARCHAR2 DEFAULT NULL)
This function returns a RAW
value.
Parameters
r
r
contains the RAW
string that will be translated to uuencode format.
type
type
is an INTEGER
value or constant that specifies the type of uuencoded string that will be returned; the default value is 1
. The possible values are:
Value | Constant |
---|---|
1 | complete |
2 | header_piece |
3 | middle_piece |
4 | end_piece |
filename
filename
is a VARCHAR2
value that specifies the file name that you want to embed in the encoded form; if you do not specify a file name, UUENCODE
will include a filename of uuencode.txt
in the encoded form.
permission
permission
is a VARCHAR2
that specifies the permission mode; the default value is NULL
.
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, refer to the Postgres Core Documentation available at:
https://www.postgresql.org/docs/12/static/datatype-binary.html
The following example uses UUENCODE
and UUDECODE
to first encode and then decode a string:
edb=# SET bytea_output = escape; SET edb=# SELECT UTL_ENCODE.UUENCODE('What is the date?') FROM DUAL; uuencode -------------------------------------------------------------------- begin 0 uuencode.txt\01215VAA="!I<R!T:&4@9&%T93\\`\012`\012end\012 (1 row) edb=# SELECT UTL_ENCODE.UUDECODE edb-# ('begin 0 uuencode.txt\01215VAA="!I<R!T:&4@9&%T93\\`\012`\012end\012') edb-# FROM DUAL; uudecode ------------------- What is the date? (1 row)