BLOB - image into Teradata

Database
Enthusiast

BLOB - image into Teradata

Hi,

 

I have some images on my system and want to try loading them into TD.

Can someone please help me here with bteq.? What are the other possible ways of loading them.(apart from java).

Also can you please explain how theses objects are stored and retrieved physically.

1 REPLY
Teradata Employee

Re: BLOB - image into Teradata

An alternative to using inline mode to insert LOB data into a table via BTEQ is to use the .IMPORT command, in conjunction with an UPDATE command.

 

CREATE TABLE t1
(col_a INT
,clob_1 CLOB(80K));

INSERT INTO t1 VALUES (1,NULL); /* Inserts a row into the table with a null LOB placeholder */

.IMPORT VARTEXT FILE = C:\Gettysburg_text.txt;

USING (x VARCHAR(20000)) UPDATE t1 SET clob_1 = :x WHERE col_a = 1; /* Updates the column to contain the LOB value */
 
Note that the size of the input variable needs to be at least large enough to hold the actual data value. In this case it is made larger.