TEXT_DECODE v13

Use the TEXT_DECODE function to translate and decode an encoded string to the VARCHAR2 value that was originally encoded by the TEXT_ENCODE function. The signature is:

TEXT_DECODE(<buf> IN VARCHAR2, <encode_charset> IN VARCHAR2 DEFAULT
NULL, <encoding> IN PLS_INTEGER DEFAULT NULL)

This function returns a VARCHAR2 value.

Parameters

buf

buf contains the encoded string that will be translated to the original value encoded by TEXT_ENCODE.

encode_charset

encode_charset specifies the character set to which the string will be translated before encoding. The default value is NULL.

encoding

encoding specifies the encoding type used by TEXT_DECODE. Specify:

  • UTL_ENCODE.BASE64 to specify base-64 encoding.
  • UTL_ENCODE.QUOTED_PRINTABLE to specify quoted printable encoding. This is the default.

Examples

The following example uses the TEXT_ENCODE and TEXT_DECODE functions to first encode, and then decode a string:

edb=# SELECT UTL_ENCODE.TEXT_ENCODE('What is the date?', 'BIG5',
UTL_ENCODE.BASE64) FROM DUAL;
       text_encode
--------------------------
V2hhdCBpcyB0aGUgZGF0ZT8=
(1 row)

edb=# SELECT UTL_ENCODE.TEXT_DECODE('V2hhdCBpcyB0aGUgZGF0ZT8=', 'BIG5',
UTL_ENCODE.BASE64) FROM DUAL;
    text_decode
-------------------
What is the date?
(1 row)