Nina via DBMonster.com wrote:
Hi,
I'm trying to insert a clob / blob from the local file system into a basic
table. This can be quite easily accomplished in Oracle but I have not found
any wquivalent way on how to do this in DB2. I have the following table:
create table docs(
doc_id integer,
docs clob(),
constraint pk PRIMARY KEY (doc_id))
The documents that i want to insert into clobs are located at the c drive
so the path is "c:/docs"
I would really appreciate any help here.
BTW: I want to do this without using any external programming language.
You can use the IMPORT command, with the LOBSINFILE option. Example:
"import from file.del of del modified by lobsinfile replace into table"
Your file would look something like this (assuming your table has only
2 columns)
123,"abc.txt.0.1024/"
(where 0 means the offset in bytes within the file to start reading the
lob, and 1024 is the length of the string to read).
See the docs for IMPORT and especially the file type modifiers for
IMPORT that will describe this in more detail.