使用sql loader将小数加载到oracle表中

时间:2014-02-20 09:28:49

标签: oracle csv decimal sql-loader

我在oracle中有这个表:

CREATE TABLE mytable
(
TSTAMP  Date,
prmc1 VARCHAR2(30),
prmc2 VARCHAR2(30),
prmc3 VARCHAR2(30),
prmc4 VARCHAR2(30),
prmc5 NUMBER,
prmc5 NUMBER,
prmc6 NUMBER
)

控制文件如下:

load data
append
 into table mytable
fields terminated by ',' TRAILING NULLCOLS
 ( tstamp DATE "YYYY-MM-DD HH24:MI" TERMINATED BY ",",
   prmc1 ":prmc1",
prmc2 ":prmc2",
prmc3 ":prmc3",
prmc4 ":prmc4",
prmc5 INTEGER  ":prmc5",
prmc6 INTEGER  ":prmc6"
)

csv文件中prmc5列的值为-106.436

如何将其加载到表中?

1 个答案:

答案 0 :(得分:1)

您只需将其指定为DECIMAL EXTERNAL

即可

我也在删除指定格式为列本身。

load data
append
 into table mytable
fields terminated by ',' TRAILING NULLCOLS
 ( tstamp DATE "YYYY-MM-DD HH24:MI" TERMINATED BY ",",
   prmc1 ,
prmc2 ,
prmc3 ,
prmc4 ,
prmc5 DECIMAL EXTERNAL,
prmc6 DECIMAL EXTERNAL
)

更多细节与一些示例here