By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,924 Members | 1,651 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,924 IT Pros & Developers. It's quick & easy.

Insert CLOB / BLOB

P: n/a

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.

Nina

--
Message posted via http://www.dbmonster.com
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

Nina

Do you have the IBM Administration Tools installed?
You can there with the control center make an insert by gui but the best
thing you get the sql code also there.

cu,

indika
Nov 12 '05 #2

P: n/a
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.


Then you'll have a bit of a problem, I'd say.

As for external languages, you could use a UDF as is described here:
http://www-128.ibm.com/developerwork...dm-0504stolze/

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #3

P: n/a
Ian
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.

Nov 12 '05 #4

P: n/a
Thanks :-)

--
Message posted via http://www.dbmonster.com
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.