bash 连接sqlldr中的多个字段

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11451733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 02:44:27  来源:igfitidea点击:

concatenate multiple fields in sqlldr

bashshelloracle11gsql-loader

提问by kattashri

I am working on sqlldr(sql loader) in oracle 11g. I am trying to concatenate 3 fields into a single field. Has anyone done this?

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

ex: TABLE - "CELLINFO" where the fields are (mobile_no,service,longitude).

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

The data given is (+9198449844,idea,110,25,50) i.e. (mobile_no,service,grad,min,sec).

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

But while loading data into the table i need to concatenate the last 3 fields (grad,min,sec) into the longitude field of the table.

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

Here i cant edit manually because i have 1000's of data to be loaded.

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

I also tried using ||,+ and concat().... but I am not able to.

我也尝试使用 ||,+ 和 concat().... 但我不能。

回答by Florin Ghita

ctl may be:

ctl 可能是:

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

suposing cellinfo(mobile_no, service, latitude).

假设 cellinfo(mobile_no, service, latitude)。

Some nice info here on orafaq

orafaq 上的一些不错的信息

Alternatively, you can modify your input:

或者,您可以修改您的输入:

awk -F"," '{print ","","":"":"}' inputfile > outputfile