sqlloader 和管理空值
sqlloader and manage nulls
我需要在我的 sqlloader 中管理空值。
例子:
我的数据:
2;200A;
1;300B;45
5;105C;
6;204D;;
我的ctl文件:
LOAD DATA
INFILE *
insert INTO TABLE TABLE_AUX
FIELDS TERMINATED BY ';'
(
CODE1,
CODE2,
CODE3
)
结果在我的 table 中:
2 200A
1 300B 45
5 105C
6 204D (null)
我需要空格为空。
我知道如果在我的数据中放另一个“;”最终问题将得到解决,但我无法触摸此文件。
谢谢!
试试下面的查询
select * from table_aux where trim(code3) is null;
select * from table_aux where code3 is null;
select * from table_aux where code3=' ';
记录 2 和 5 的 code3 列中必须有一些 space。
所以将 space 转换为 null 使用下面的代码
LOAD DATA
INFILE *
insert INTO TABLE TABLE_AUX
FIELDS TERMINATED BY ';'
(
CODE1,
CODE2,
CODE3 trim(:CODE3)
)
我需要在我的 sqlloader 中管理空值。
例子:
我的数据:
2;200A;
1;300B;45
5;105C;
6;204D;;
我的ctl文件:
LOAD DATA
INFILE *
insert INTO TABLE TABLE_AUX
FIELDS TERMINATED BY ';'
(
CODE1,
CODE2,
CODE3
)
结果在我的 table 中:
2 200A
1 300B 45
5 105C
6 204D (null)
我需要空格为空。 我知道如果在我的数据中放另一个“;”最终问题将得到解决,但我无法触摸此文件。
谢谢!
试试下面的查询
select * from table_aux where trim(code3) is null;
select * from table_aux where code3 is null;
select * from table_aux where code3=' ';
记录 2 和 5 的 code3 列中必须有一些 space。
所以将 space 转换为 null 使用下面的代码
LOAD DATA
INFILE *
insert INTO TABLE TABLE_AUX
FIELDS TERMINATED BY ';'
(
CODE1,
CODE2,
CODE3 trim(:CODE3)
)