Hmm.. Especially the error message caused misunderstanding,

21 bytes can not be inserted into 24 bytes?

*** ERROR[8402] A string overflow occurred during the evaluation of a character 
expression. Conversion of Source Type:VARCHAR(REC_BYTE_V_ASCII,21 BYTES,UTF8) 
Source Value:我我我我我我我 to Target Type:VARCHAR(REC_BYTE_V_ASCII,24 BYTES,UTF8). 
[2017-06-27 15:44:45]


Best regards,
Yuan
Email: yuan....@esgyn.cn<mailto:yuan....@esgyn.cn>
Cellphone: (+86) 13671935540

From: Xu, Kai-Hua (Kevin) [mailto:kaihua...@esgyn.cn]
Sent: Tuesday, June 27, 2017 3:49 PM
To: user@trafodion.incubator.apache.org
Subject: RE: How many Chinese characters can be stored in varchar(n chars) 
character set utf8?

I got the same error on sqlci. I would suggest you use trafci. Ture, it an 
issue.
[cid:image001.jpg@01D2EF5D.54A3E5B0]

Best Regards,
Kevin Xu

From: Xu, Kai-Hua (Kevin)
Sent: Tuesday, June 27, 2017 3:41 PM
To: 
user@trafodion.incubator.apache.org<mailto:user@trafodion.incubator.apache.org>
Subject: RE: How many Chinese characters can be stored in varchar(n chars) 
character set utf8?

Hi Yuan,

Curious, it works for me.
[cid:image002.jpg@01D2EF5D.54A3E5B0]

Best Regards,
Kevin Xu

From: Liu, Yuan (Yuan) [mailto:yuan....@esgyn.cn]
Sent: Tuesday, June 27, 2017 2:54 PM
To: 
user@trafodion.incubator.apache.org<mailto:user@trafodion.incubator.apache.org>
Subject: How many Chinese characters can be stored in varchar(n chars) 
character set utf8?

Hi Trafodioneers,

I created one table as below,
>>create table test_utf8(a varchar(6) character set utf8);

--- SQL operation complete.
>>showddl test_utf8;

CREATE TABLE TRAFODION.SEABASE.TEST_UTF8
  (
    A                                VARCHAR(6 CHARS) CHARACTER SET UTF8
      COLLATE DEFAULT DEFAULT NULL NOT SERIALIZED
  )
ATTRIBUTES ALIGNED FORMAT
;

Then I tried to insert Chinese characters into the table,
>>insert into test_utf8 values('我我我');

*** ERROR[8402] A string overflow occurred during the evaluation of a character 
expression. Conversion of Source Type:VARCHAR(REC_BYTE_V_ASCII,18 BYTES,UTF8) 
Source Value:我我我 to Target Type:VARCHAR(REC_BYTE_V_ASCII,24 BYTES,UTF8).
>>insert into test_utf8 values('我我');

--- 1 row(s) inserted.

It seems that I can only insert 2 Chinese characters into the column, which is 
not as expected as I thought.

So I‘d want to ask how should I define the data type if I want to store N 
Chinese characters?

Another thing is that, from the error message, why the Source Type of ‘我我我’ is 
18 bytes, utf8 while the target type is 24 bytes, utf8?


Best regards,
Yuan
Email: yuan....@esgyn.cn<mailto:yuan....@esgyn.cn>
Cellphone: (+86) 13671935540

Reply via email to