How to insert BLOB into a table?
Posted on 2005-03-01
I have a table that has a BLOB field. The table is defined as follows:
create table raw_image(
image_id INTEGER NOT NULL,
I used the following statements to insert a row, from the DB2 command line processor, into the above table:
db2 "insert into raw_image values (1, '##/home/db2inst1/images/PICT0011.JPG')"
db2 "insert into raw_image values (1, '/home/db2inst1/images/PICT0011.JPG')"
but got the following error for both statements:
SQL0408N A value is not compatible with the data type of its assignment
target. Target name is "IMAGE". SQLSTATE=42821
I got the syntax '##' from somewhere on the web. It says that using '##' means to get the content of the image file. I guess it's not right for DB2. How can I insert a row then? If I can get this to work, then I can import bunch of images into the table by using a DEL file and DB2 import utility.