我正在使用 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().... 但我做不到。
最佳答案
ctl 可能是:
load data
append
into table cellinfo
fields terminated by ","
(
mobile_no,
service,
grad BOUNDFILLER,
min BOUNDFILLER,
sec BOUNDFILLER,
latitude ":grad || :min|| :sec"
)
假设手机信息(手机号、服务、纬度)。
一些不错的信息 here on orafaq
或者,您可以修改您的输入:
awk -F"," '{print $1","$2","$3":"$4":"$5}' inputfile > outputfile
关于bash - 在 sqlldr 中连接多个字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11451733/