You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@trafodion.apache.org by "Liu, Ming (Ming)" <mi...@esgyn.cn> on 2016/02/17 00:03:22 UTC

答复: how to use BLOB/CLOB in Trafodion?

Thanks, Sandhya,

This is very helpful and exactly what I want to know.

Best Regards,
Ming

发件人: Sandhya Sundaresan [mailto:sandhya.sundaresan@esgyn.com]
发送时间: 2016年2月17日 2:46
收件人: user@trafodion.incubator.apache.org
主题: RE: how to use BLOB/CLOB in Trafodion?

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.liu@esgyn.cn<ma...@esgyn.cn>]
Sent: Tuesday, February 16, 2016 6:34 AM
To: user@trafodion.incubator.apache.org<ma...@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