oracle 将数据从平面文件加载到包含 clob 数据类型的表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3930936/
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 21:41:59  来源:igfitidea点击:

loading data to a table containing clob datatype, from a flat file

oraclesql-loader

提问by Aby

I am trying to populate a table with the values taken from a flat file using SQLLDR.The problem is that one of the fields in the table is of CLOB datatype(lets say the field name is COMMENTS). In the control file, i have mentioned the datatype for this field as CHAR(4000), since the usage of CLOB in control file was not working. But this also fails when there is a EndOfLine present in the field. Thus it tries to load the next line as new record and fails.

我正在尝试使用 SQLLDR 从平面文件中获取的值填充表。问题是表中的一个字段是 CLOB 数据类型(假设字段名称是 COMMENTS)。在控制文件中,我已经提到该字段的数据类型为 CHAR(4000),因为控制文件中 CLOB 的使用不起作用。但是当字段中存在 EndOfLine 时,这也会失败。因此它尝试将下一行加载为新记录并失败。

Please suggest a solution to this.... Thanks in advance

请提出一个解决方案......提前致谢

回答by erbsock

You may have to do this programatically using perl or something similar. Alternatively, you can use something like the example given here:

您可能必须使用 perl 或类似的东西以编程方式执行此操作。或者,您可以使用类似于此处给出的示例的内容:

http://www.oracle-base.com/articles/10g/LoadLobDataUsingSqlLoader.php

http://www.oracle-base.com/articles/10g/LoadLobDataUsingSqlLoader.php

回答by DCookie

You don't say why the CLOB specification in the control file failed, but if you're at 9i or later, you shouldbe able to load a CLOB via sqlldr.

您没有说明为什么控制文件中的 CLOB 规范失败,但是如果您使用的是 9i 或更高版本,您应该能够通过 sqlldr 加载 CLOB

Failing that, you might be able to work out assembling logical records from physical recordsvia CONTINUEIF.

否则,您可能能够通过 CONTINUEIF从物理记录中组装逻辑记录