Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL UTL_ENCODE Package      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: UTL_ENCODE

Definition:
In Oracle PL/SQL, UTL_ENCODE is an Oracle supplied package which is used to encode a piece of data into a standard code format. The encoded data can be transferred between the host servers. It contains multiple subprograms to support encoding and decoding process as listed below.

  • BASE64_DECODE Function - Reads the base 64-encoded RAW input string and decodes it to its original RAW value

  • BASE64_ENCODE Function - Encodes the binary representation of the RAW value into base 64 elements and returns it in the form of a RAW string

  • MIMEHEADER_DECODE Function - Decodes a string from mime header format

  • MIMEHEADER_ENCODE Function - Encodes a string into mime header format

  • QUOTED_PRINTABLE_DECODE Function - Reads the varchar2 quoted printable format input string and decodes it to the corresponding RAW string

  • QUOTED_PRINTABLE_ENCODE Function - Reads the RAW input string and encodes it to the corresponding quoted printable format string

  • TEXT_DECODE Function - Decodes a character set sensitive text string

  • TEXT_ENCODE Function - Encodes a character set sensitive text string

  • UUDECODE Function - Reads the RAW uuencode format input string and decodes it to the corresponding RAW string

  • UUENCODE Function - Reads the RAW input string and encodes it to the corresponding uuencode format string


Example Usage:

Sample implementation to enable sending of Cyrillic e-mails through an MS Exchange server.

function from_base64(t in varchar2) return varchar2 is
begin
return utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw(t)));
end from_base64;


SQL> set serveroutput ON
SQL>
SQL> DECLARE
function to_base64(t in varchar2) return varchar2 is
BEGIN
return utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(t)));
END to_base64;

function from_base64(t in varchar2) return VARCHAR2 is
BEGIN
return utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw (t)));
END from_base64;

BEGIN
dbms_output.put_line(from_base64(to_base64('asdf')));
END;
/

PL/SQL procedure successfully completed


Related Links:
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 298 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?