Hi Ming,

     You can insert data directly from a file. But since the feature is
still under testing, you need to set the following CQDs to enble the
feature :

cqd traf_blob_as_varchar 'OFF';

cqd traf_clob_as_varchar 'OFF';



Your file can be a local file or an hdfs file on the system.

Here are a couple of simple examples. You can look at
*core/sql/regress/executor/TEST130* for more comprehensive examples :

For a local file :



create table tlobh3 (c1 int not null, c2 blob, primary key (c1));

insert into tlobh3 values (1, filetolob('/home/sandhyasun/afile'));



For an hdfs file, you need to provide the following syntax :



insert into tlobh3 values (1, filetolob('hdfs:///mydata/c1.txt'));



Sandhya

*From:* Liu, Ming (Ming) [mailto:ming....@esgyn.cn]
*Sent:* Tuesday, February 16, 2016 6:34 AM
*To:* user@trafodion.incubator.apache.org
*Subject:* how to use BLOB/CLOB in Trafodion?



Hi, all,



I am interested about how can a user use BLOB/CLOB in Trafodion?

I see usage of stringtolob() and lobtostring() like this:



insert into tbl values(1,stringtolob('clob values'));

select lobtostring(c2,10) from tbl;



This is fine if I have not too long string, but if I have a big text file
and want to insert the whole text file into a CLOB column, how can I do
that?



Thanks,

Ming

Reply via email to