Tuesday, September 30, 2014

Convert BLOB to CLOB

This Function is used to convert BLOB files (Images) to CLOB.
This can be used to display Images in the XML Publisher Reports as you cannot directly display the images stored in BLOB format in XML Publisher.

/* ---------------------------------
    TO GET IMAGES USING FUNCTION:
----------------------------------- */
   FUNCTION getbase64 (p_source BLOB)
      RETURN CLOB
   IS
      v_result   CLOB;
   BEGIN
      DBMS_LOB.createtemporary (lob_loc      => v_result, CACHE => FALSE,
                                dur          => 0);
      wf_mail_util.encodeblob (p_source, v_result);
      RETURN (v_result);
   EXCEPTION
      WHEN OTHERS
      THEN
         RETURN NULL;

   END getbase64;