加载语句参数preserve blanks用于设定是否保留字段内容两端的空格,加载语句默认不保留空格。
加载语句示例:drop database if exists test;create database test;use test;create table t(a int, b varchar(20),c bigint); (1)加载默认不保留空格load data infile 'file://${ip_host}/opt/t.tbl' into table t fields terminated by '|';
图片

(2)加载语句参数preserve blanks,保留字段两端空格load data infile 'file://${ip_host}/opt/t.tbl' into table t fields terminated by '|' preserve blanks;
图片

(3)加载语句参数preserve leading blanks,保留字段左端空格load data infile 'file://${ip_host}/opt/t.tbl' into table t fields terminated by '|' preserve leading blanks;
图片

(4)加载语句参数preserve trailing blanks,保留字段右端空格load data infile 'file://${ip_host}/opt/t.tbl' into table t fields terminated by '|' preserve trailing blanks;
图片


GBase数据库
1 声望2 粉丝

GBase数据库知识分享