使用sql loader加载文件时的数字无效?

时间:2015-04-04 20:57:16

标签: sql loader sql-loader

以下是我的.ctl文件中的内容:

load data infile './certified.txt' 
append into table certified 
fields terminated by "," (employeeID, airplaneID)

错误(重复无效的数字行短路):

SQL*Loader: Release 10.2.0.4.0 - Production on Sat Apr 4 16:41:04 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Control File:   loader.ctl
Data File:      ./certified.txt
  Bad File:     certified.bad
  Discard File:  none specified

 (Allow all discards)

Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array:     64 rows, maximum of 256000 bytes
Continuation:    none specified
Path used:      Conventional

Table CERTIFIED, loaded from every logical record.
Insert option in effect for this table: APPEND

   Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
EMPLOYEEID                          FIRST     *   ,       CHARACTER            
AIRPLANEID                           NEXT     *   ,       CHARACTER            

Record 1: Rejected - Error on table CERTIFIED, column AIRPLANEID.
ORA-01722: invalid number

Record 2: Rejected - Error on table CERTIFIED, column AIRPLANEID.
ORA-01722: invalid number
MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.

Table CERTIFIED:
  0 Rows successfully loaded.
  51 Rows not loaded due to data errors.
  0 Rows not loaded because all WHEN clauses were failed.
  0 Rows not loaded because all fields were null.


Space allocated for bind array:                  33024 bytes(64 rows)
Read   buffer bytes: 1048576

Total logical records skipped:          0
Total logical records read:            64
Total logical records rejected:        51
Total logical records discarded:        0

Run began on Sat Apr 04 16:41:04 2015
Run ended on Sat Apr 04 16:41:04 2015

Elapsed time was:     00:00:00.28
CPU time was:         00:00:00.03

我用来创建表的行是:

create table certified (employeeID int, airplaneID int);

这是数据文件中的内容(同样省略了一些数据,行之间没有空格,只是把它放在那里,因为我对这个网站的格式有问题):

567354612,1
567354612,2
567354612,10
567354612,11
567354612,12

1 个答案:

答案 0 :(得分:0)

我的问题是文本文件存在问题。以下命令修复了它们,一切正常!

perl -p -i -e 's/\r\n$/\n/g' aircraft.txt certified.txt flights.txt employees.txt