数据在SQLLDR的时候提示错误, 使用TRAILING NULLCOLS

来源:互联网 发布:软件著作权 专利 区别 编辑:程序博客网 时间:2024/06/13 18:17

数据在SQLLDR的时候提示错误
在逻辑记录结束之前未找到列

1.sale.log文件

SQL*Loader: Release 10.2.0.4.0 - Production on Fri Jun 27 16:02:28 2014


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


Control File:   sale.ctl
Data File:      sale418.csv
  Bad File:     sale418.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 TMP3, loaded from every logical record.
Insert option in effect for this table: INSERT


   Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
USERNAME                            FIRST     *   ,       CHARACTER
PHONE1                               NEXT     *   ,       CHARACTER
PHONE2                               NEXT     *   ,       CHARACTER
PHONE3                               NEXT     *   ,       CHARACTER
EMAIL1                               NEXT     *   ,       CHARACTER
EMAIL2                               NEXT     *   ,       CHARACTER


Record 1: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 3: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 6: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 7: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 8: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)

Record 10: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 11: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 12: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 14: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 16: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 18: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 19: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 20: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 21: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 22: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 25: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 30: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 33: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 34: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 35: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 36: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 39: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 40: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 44: Rejected - Error on table TMP3, column EMAIL2.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 51: Rejected - Error on table TMP3, column EMAIL2.

MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.




Table TMP3:
  70 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:                  99072 bytes(64 rows)
Read   buffer bytes: 1048576


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


Run began on Fri Jun 27 16:02:28 2014
Run ended on Fri Jun 27 16:02:31 2014


Elapsed time was:     00:00:02.99
CPU time was:         00:00:00.01

1.查看bad文件,找到错误数据是否与 要导入的excel或者txt文件的列数、要导入的目标表的列数一致

2.如果列一致,查看最后一列是否为空,如果最后一列为空,sqlldr运行时会报错
加上trailing nullcols (表的字段没有对应的值时允许为空 ),

将所有不在纪录中的指定位置的列当作空值,指记录中没有内容(空格、空白、或null)的列被当作null


load data
infile 'sale418.csv'
into table tmp3
fields terminated by ','
trailing nullcols -----将所有不在纪录中的指定位置的列当作空值
(username,phone1,phone2,phone3,email1,email2)



0 0
原创粉丝点击