49.5 BLOB2CLOBBASE64 Function

This function converts a BLOB datatype into a CLOB that is base64-encoded. This is often used when sending a binary as an input to a Web service.

Syntax

APEX_WEB_SERVICE.BLOB2CLOBBASE64 (
    p_blob IN BLOB)
RETURN CLOB;

Parameters

Table 49-3 BLOB2CLOBBASE64 Parameters

Parameter Description
p_blob The BLOB to convert into base64 encoded CLOB.

Example

The following example gets a file that was uploaded from the apex_application_files view and converts the BLOB into a CLOB that is base64-encoded.

DECLARE
    l_clob    CLOB;
    l_blob    BLOB;
BEGIN
    SELECT BLOB_CONTENT
      INTO l_BLOB
      FROM APEX_APPLICATION_FILES
      WHERE name = :P1_FILE;

    l_CLOB := apex_web_service.blob2clobbase64(l_BLOB);
END;