gpt4 book ai didi

mysql - 使用csv从oracle导入到mysql

转载 作者:行者123 更新时间:2023-11-29 21:20:12 26 4
gpt4 key购买 nike

我有一个从 oracle 数据库导出的 csv 文件(12 GB),

格式如下

6436,,N,,,,,,,,,,,,04/01/1999,04/01/1999,352,1270,1270,406,406,1999,1,31/01/1999,0,88,0,A,11/12/2005,N,0,11/12/2005,,,,1270,1,0,,2974,,,,,,,,,,,,,,,,,,,,,,,,

如您所见,它有很多空值(大部分是整数),当我将其导入 mysql 数据库时,它用零填充空值

喜欢,

6436,0,0,,0,0,0,0,0,0,0,0,0,0,4,04/01/1999,04/01/1999,1270,1270,406,406,1999,1,31,31/01/1999,88,0,A,11/12/2005,N,0,11/12/2005,0,0,0,1270,1,0,,2974,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,0,0,00/00/0000,0,,0,0

这里真正的问题是什么?谢谢。

最佳答案

我通过 @Marc B 的有用评论弄清楚了

我写了类似的东西

LOAD DATA LOCAL INFILE '/path/data.csv' INTO TABLE table_name
FIELDS TERMINATED BY ','
IGNORE 1 LINES
(columns with @)

SET
column = IF(length(@column)= 0,null,@column),
date = str_to_date(@date, '%d/%m/%Y');

关于mysql - 使用csv从oracle导入到mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35753996/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com