简体   繁体   English

SQL loader:将具有嵌入式\\ r \\ n的.CSV文件加载到oracle中

[英]Sql loader: Loading .CSV files with embedded \r\n into oracle

I have a .csv file where data in some columns have one or multi \\r\\n. 我有一个.csv文件,其中某些列中的数据具有一个或多个\\ r \\ n。 I need to load them into oracle without these \\r\\n but SQLLDR gives an error. 我需要在没有这些\\ r \\ n的情况下将它们加载到oracle中,但是SQLLDR给出了错误。

below are the sample of records: 以下是记录示例:

R1: R1:

"A", "B", "
CDE
FGH" , ...

R2: R2:

"A", "B", "
CDE

FGH" , ...

R3: R3:

"A", "B", "C
DEF
GH" , ...

R4: R4:

"A", "B", "C
DE" , ...

I used 我用了

  • continueif last != '"' , 如果最后!='“',
  • "STR '\\r\\n'" and “ STR'\\ r \\ n'”和
  • replace (:ColumnName, chr(13) || chr(10), ' '), 替换(:ColumnName,chr(13)|| chr(10),''),

    in the control file, but these solutions didn't work. 在控制文件中,但是这些解决方案不起作用。 So, How can I handle this? 那么,我该如何处理呢?

Edit: Here is header of my control file: 编辑:这是我的控制文件的标头:

OPTIONS (DIRECT=TRUE)
LOAD DATA
INFILE 'E:test.csv'
INTO TABLE TEMP
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
...

I found it. 我找到了。 I should use : CONTINUEIF NEXT PRESERVE(1) != ' " ', because records starts with ' " ' and As long as the next lines are opposed to ' " ', they all count as one record. 我应该使用:CONTINUEIF NEXT PRESERVE(1)!='“',因为记录以'”'开头,只要下一行与'“'相对,它们都算作一条记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM