连接sqlldr中的多个字段

时间:2012-07-12 12:21:11

标签: bash shell oracle11g sql-loader

我正在oracle 11g中使用sqlldr(sql loader)。 我试图将3个字段连接成一个字段。有没有人这样做过?

例如: 表 - “CELLINFO”,其中字段为(mobile_no,service,longitude)。

给出的数据是(+ 9198449844,idea,110,25,50),即(mobile_no,service,grad,min,sec)。

但是在将数据加载到表格中时,我需要将最后3个字段(grad,min,sec)连接到表格的经度字段中。

这里我无法手动编辑,因为我有1000个要加载的数据。

我也尝试过使用||,+和concat()....但我无法做到。

1 个答案:

答案 0 :(得分:6)

ctl可能是:

load data
append
into table      cellinfo
fields terminated by ","
(
mobile_no,
service,
grad BOUNDFILLER,
min BOUNDFILLER,
sec BOUNDFILLER,
latitude ":grad || :min|| :sec"
)

提供cellinfo(mobile_no,service,latitude)。

一些不错的信息here on orafaq

或者,您可以修改输入:

awk -F"," '{print $1","$2","$3":"$4":"$5}' inputfile > outputfile