How to load data type fixed width support thai language
sample data utf8 have thai language
9999Aเจ้าหน้าที่.........................................................................................AX999....XXXX20221214
table structure name ABC
A1 char(5)
A2 varchar(100)
A3 char(1)
A4 char(4)
A5 char(4)
A6 char(4)
A7 char(8)
when I use command copy load
COPY public.ABC ( A1,A2,A3,A4,A5,A6,A7) from local '/data/sampledata.TXT' FIXEDWIDTH colsizes(5,100,1,4,4,4,8) skip 0 rejected data as table public.ABC_RJCT ENFORCELENGTH;
Rows Loaded = 0
and rejected_reason from table reject public.ABC_RJCT
"Row is malformed. Including record terminator, expected size is 127 bytes. Row size is 149 bytes."
I try expand data type A2 is varchar(400) but failed.
reason is the same,
"Row is malformed. Including record terminator, expected size is 127 bytes. Row size is 149 bytes."
Where do I need to make additional settings or edit? to be able to load the data.
Leave a Comment
Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.
Answers
This exact question was answered here:
https://forum.vertica.com/discussion/242875/how-to-load-data-type-fixed-width-support-thai-language
I try expand data type A2 is varchar(400) but failed.
reason is the same,
"Row is malformed. Including record terminator, expected size is 127 bytes . Row size is 149 bytes."
Where do I need to make additional settings or edit? to be able to load the data.
It means that you very probably had 12 blanks more than you need.
If
'เจ้าหน้าที่'
is data for column A2, and you use 100 bytes for A2, you will have to run this:marco ~/1/Vertica/supp $ vsql -c "SELECT OCTET_LENGTH('เจ้าหน้าที่')"
OCTET_LENGTH
--------------
33
, and with that piece of info, put 67, that is, 100 - 33, not more not fewer, blanks after
'เจ้าหน้าที่'
into your file, to make the row not malformed.