Can any one tell me how to convert a CLOB into BLOB? In Oracle 10g there is a function which is converttoblob(). But in Oracle 9i there is no function as such. If i am using Hextoraw() function still then its giving some pointer error. please let me know the solution.
FUNCTION c2b( c IN CLOB ) RETURN BLOB
-- typecasts CLOB to BLOB (binary conversion)
pos PLS_INTEGER := 1;
buffer RAW( 32767 );
lob_len PLS_INTEGER := DBMS_LOB.getLength( c );
DBMS_LOB.createTemporary( res, TRUE );
DBMS_LOB.OPEN( res, DBMS_LOB.LOB_ReadWrite );
buffer := UTL_RAW.cast_to_raw( DBMS_LOB.SUBSTR( c, 16000, pos ) );
IF UTL_RAW.LENGTH( buffer ) > 0 THEN
DBMS_LOB.writeAppend( res, UTL_RAW.LENGTH( buffer ), buffer );
pos := pos + 16000;
EXIT WHEN pos > lob_len;
RETURN res; -- res is OPEN here
I have a table with a column which is BLOB and another column is CLOB. I have inserted a Microsoft Word file into the BLOB column. I would like to copy the BLOB to another column in CLOB. It is possible? If yes, how? Thanks.