48.9 CLOB_TO_BLOB Function
This function converts a CLOB to a temporary BLOB.
Syntax
APEX_UTIL.CLOB_TO_BLOB (
p_clob IN CLOB,
p_charset IN VARCHAR2 DEFAULT NULL,
p_include_bom IN VARCHAR2 DEFAULT 'N',
--
p_in_memory IN VARCHAR2 DEFAULT 'Y',
p_free_immediately IN VARCHAR2 DEFAULT 'Y' )
RETURN BLOB;
Parameters
Table 48-9 CLOB_TO_BLOB Parameters
Parameter | Description |
---|---|
p_clob |
CLOB to convert to a BLOB. |
p_charset |
Character set to convert the BLOB to. If omitted, no character set conversion happens. |
p_include_bom |
Prepend the generated BLOB with a BOM. |
p_in_memory |
If Y is specified, create the temporary LOB in memory.
|
p_free_immediately |
If Y is specified, clean up the temporary LOB after the top-level call.
|
Returns
Temporary BLOB containing the CLOB contents.
Example
The following example converts a CLOB to a BLOB, with and without charset conversion.
DECLARE
l_clob clob;
l_blob blob;
BEGIN
l_clob := to_clob( 'This is some CLOB content with umlauts: ü,ä,ö.' );
l_blob := apex_util.clob_to_blob(
p_clob => l_clob,
p_charset => 'AL32UTF8' );
sys.dbms_output.put_line( 'The utf-8 BLOB has ' || sys.dbms_lob.getlength( l_blob ) || ' bytes.' );
l_blob := apex_util.clob_to_blob(
p_clob => l_clob,
p_charset => 'WE8ISO8859P1' );
sys.dbms_output.put_line( 'The iso-8859-1 BLOB has ' || sys.dbms_lob.getlength( l_blob ) || ' bytes.' );
END;
Parent topic: APEX_UTIL