Insert BLOB data into Oracle database table
BLOB data can be inserted into an Oracle database table with BLOB datatype by the use of UTL_RAW.cast_to_raw( blob_data ) if the data is large plain text.

Insert BLOB Data (text)
 INSERT INTO lu_db_architecture
  (architecture_cd, architecture_desc)
 VALUES('BLOB',UTL_RAW.cast_to_raw('Large objects (LOBs) are '||
  'set of datatypes that are designed to hold large amounts '||
  'of data.  A LOB can hold upto a maximum size ranging from '||
  '8TB to 128TB based on database configuration');

To insert other types of BLOB data such as images, video file etc., it is done in a multi step process. First an EMPTY_BLOB() placeholder as to be created. The file has to be updated next. Here just the same plain text data is used. To upload a video file, etc., DBMS_LOB package features have to be used.

Insert BLOB Data
DECLARE
 v_blob   BLOB;

BEGIN
 INSERT INTO lu_db_architecture
  (architecture_cd, architecture_desc)
 VALUES('BLOB', EMPTY_BLOB());

 v_blob := UTL_RAW.cast_to_raw('Large objects (LOBs) are set of '||
  'datatypes that are designed to hold large amounts of data.  A'||
  'LOB can hold upto a maximum size ranging from 8TB to 128TB '||
  'based on database configuration');
   
 UPDATE lu_db_architecture
  SET architecture_desc = v_blob
 WHERE  architecture_cd = 'BLOB';
 -- COMMIT;                        -- by calling front end
END;
/

Oracle registered trademark of Oracle Corporation.

Last Revised On: November 08, 2013

  1430