您在控制文件中定义了 5 个字段。您的字段以逗号结尾,因此除非指定了 TRAILING NULLCOLS,否则 5 个字段的每条记录都需要 5 个逗号,即使您正在通过 SQL 字符串加载带有序列值的 ID 字段。
回复:OP评论
这不是我对简短测试的经验。使用以下控制文件:
load data
infile *
into table T_new
fields terminated by "," optionally enclosed by '"'
( A,
B,
C,
D,
ID "ID_SEQ.NEXTVAL"
)
BEGINDATA
1,1,,,
2,2,2,,
3,3,3,3,
4,4,4,4,,
,,,,,
产生以下输出:
Table T_NEW, loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
A FIRST * , O(") CHARACTER
B NEXT * , O(") CHARACTER
C NEXT * , O(") CHARACTER
D NEXT * , O(") CHARACTER
ID NEXT * , O(") CHARACTER
SQL string for column : "ID_SEQ.NEXTVAL"
Record 1: Rejected - Error on table T_NEW, column ID.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 2: Rejected - Error on table T_NEW, column ID.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 3: Rejected - Error on table T_NEW, column ID.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 5: Discarded - all columns null.
Table T_NEW:
1 Row successfully loaded.
3 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
1 Row not loaded because all fields were null.
请注意,正确加载的唯一行有 5 个逗号。即使是第三行,除了 ID 之外的所有数据值都存在,数据也不会加载。除非我错过了什么...
我正在使用 10gR2。