oracle 达到提交点

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

Commit point reached

sqloracle

提问by user3729553

Hi I'm trying to load some data in to an Oracle Table I created

嗨,我正在尝试将一些数据加载到我创建的 Oracle 表中

Here's the table I created in Vivek schema

这是我在 Vivek 架构中创建的表

Desc STAR

描述之星

Name                       NULL       TYPE
-----------------------------------------------------
STAR_ID                    Not Null    Number(4)
FIRST_NAME                             Varchar2(30)
LAST_NAME                              Varchar2(30)
DOB                                    Date
SEX                                    Char(1)
Nationality                            Varchar2(40)
Alive                                  Char(1)

Following is the data in the STAR5.CSV file I am trying to upload using SQL Loader

以下是我尝试使用 SQL Loader 上传的 STAR5.CSV 文件中的数据

10,NASEERUDDIN,SHAH,M,INDIAN,Y
11,DIMPLE,KAPADIA,F,INDIAN,Y

The control file is as follows

控制文件如下

load data
 infile '/home/oracle/host/Vivek12/STAR_DATA5.csv'
append
into table vivek.STAR
fields terminated by "," 
( STAR_ID,FIRST_NAME,LAST_NAME,SEX,NATIONALITY,ALIVE )

When I run the SQL Loader with the following command

当我使用以下命令运行 SQL Loader 时

$ sqlldr vivek/password
control = /home/oracle/sqlldr_add_new.ct1

I get the message:

我收到消息:

Commit point reached - logical record count 2

达到提交点 - 逻辑记录数 2

However the data is not loaded and the are put in the file STAR5.bad

但是数据没有加载,而是放在文件中 STAR5.bad

Any idea why the data isn't getting loaded?

知道为什么数据没有被加载吗?

回答by Ben

You most likely have either an "invisible" character at the end of your line. Perhaps you're executing this on Linux and the file was created on Windows so you've got an extra carriage return - Linux only uses line-feed as the line terminator.

您很可能在行的末尾有一个“隐形”字符。也许您正在 Linux 上执行此操作并且该文件是在 Windows 上创建的,因此您有一个额外的回车符 - Linux 仅使用换行符作为行终止符。

Change your ctl file to remove terminating whitespace:

更改您的 ctl 文件以删除终止空格:

load data
infile '/home/oracle/host/Vivek12/STAR_DATA5.csv'
append
  into table vivek.STAR
fields terminated by "," 
 ( STAR_ID
 , FIRST_NAME
 , LAST_NAME
 , SEX
 , NATIONALITY
 , ALIVE terminated by whitespace
   )

If this doesn't work, then you're going to need to work out what characters are there and replacethem.

如果这不起作用,那么您将需要弄清楚那里有哪些字符并替换它们。