Define the column you want to skip as FILLER. Keep in mind the order of the columns in the control file is typically the order they are in the datafile. If the name matches a column in the table, that's where it will go.
...
(
f1 CHAR, -- 1st field in the file, goes to column named f1 in the table
X FILLER, -- 2nd field in the file, ignored
f3 CHAR, -- 3rd field in the file, goes to column named f3 in the table
f2 CHAR -- 4th field in the file, goes to column named f2 in the table
)
In other words, the order of the columns in the control file matches the order they are in the data file, not their order in the table. That is matched by name, not order.
EDIT - I added some comments for explanation, but I believe they can't be in that position in the actual file. See below for a full example:
Create table:
CREATE TABLE T1
(
F1 VARCHAR2(50 BYTE),
F2 VARCHAR2(50 BYTE),
F3 VARCHAR2(50 BYTE)
);
The control file, example.ctl:
load data
infile *
truncate
into table t1
fields terminated by '|' trailing nullcols
(
f1 CHAR,
x FILLER,
f3 CHAR,
f2 CHAR
)
BEGINDATA
a|b|c|d
w|x|y|z
Run it:
C:emp>sqlldr userid=login/password@database control=example.ctl
SQL*Loader: Release 11.2.0.1.0 - Production on Wed Apr 22 11:25:49 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
Select from the table:
Hopefully this helps.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…