我正在尝试在数据类型为十进制的表中导入具有''值的csv文件,但在执行此操作时会收到警告。
LOAD DATA LOCAL INFILE '/home/mysql/cdr_3may.csv' ignore
INTO table cdr_052019
FIELDS TERMINATED BY '|'
ESCAPED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(session_id, starttime, endtime, duration, duration_min, msisdn,
dialed_digits,calling_number, calling_country, called_number,
called_country, usage_type, rate,voice_promo, voice_national,
voice_roaming, used_total_volume, total_volume, data_credit,
data_share, data_promo, data_cyclic, data, data_bundle_cyclic,
data_bundle_cyclic_credit,data_roaming, data_social, sms, sms_bundle,
sms_promo, sms_roaming, sms_national, postpaid_credit, prepaid_credit,
promo_credit, main_bzd, cdr_obj_num, service_type_obj_num,subscriber_obj_num);
记录:40213删除:0跳过:0警告:281874
我的mysql是服务器版本:5.7.25-log MySQL Community Server(GPL),严格模式也已关闭。
mysql> show variables like 'sql_mode';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| sql_mode | |
+---------------+-------+
1 row in set (0.00 sec)
mysql> show warnings;
+---------+------+-------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------------------------+
| Warning | 1366 | Incorrect decimal value: '' for column 'data_share' at row 1 |
| Warning | 1366 | Incorrect decimal value: '' for column 'data' at row 1 |
| Warning | 1366 | Incorrect decimal value: '' for column 'sms_national' at row 1 |
| Warning | 1366 | Incorrect decimal value: '' for column 'postpaid_credit' at row 1 |
| Warning | 1366 | Incorrect decimal value: '' for column 'prepaid_credit' at row 1 |
| Warning | 1366 | Incorrect decimal value: '' for column 'promo_credit' at row 1 |
| Warning | 1366 | Incorrect decimal value: '' for column 'main_bzd' at row 1 |
数据文件示例
pgw.smart.com;1556731232;1666012948;40db3900; RG.3000000000|1556863200|1556863200|0||5016550468||||||DataUsage|0||||0|0|0||||||||||||||||||1265406051511|1260337306272|1265181747277
pgw.smart.com;1556852941;1667550812;21353900; RG.4002|1556863201|1556863201|0||5016692606||||||DataUsage|0||||0|0|0||||||||||||||||||1265406036740|1260337306272|1265098056712
pgw.smart.com;1556849662;1667497373;21dc3900; RG.4002|1556863201|1556863201|0||5016553949||||||DataUsage|0||||0|0|0||||||||||||||||||1265406051521|1260337306272|1265401559916