POSITION(10) 后未加载 Oracle 数据
Oracle data not loading after POSITION(10)
我一直在尝试根据某些条件从 csv 文件加载一些数据,但我受到在 when 子句 (Oracle ctl) 中使用 "OR" 控件的限制
前 11 个条件加载数据,但在前 11 个条件后不加载任何数据
以下是代码示例
create table t1 (
c1 varchar(10),
c2 varchar(10),
c3 varchar(10)
)
------------数据加载器------------
options(errors=20000)
LOAD DATA
INFILE 'D:\Scripts\abc.csv'
BADFILE 'D:\Scripts\abc.BAD'
DISCARDFILE 'D:\Scripts\abc.DIS'
DISCARDMAX 20000
insert
INTO TABLE t1
when c1='James'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1,
c2,
c3
)
INTO TABLE t1
when c1='John'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1 POSITION(1),
c2,
c3
)
INTO TABLE t1
when c1='Sam'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1 POSITION(2),
c2,
c3
)
.
.
.
INTO TABLE t1
when c1='Mark'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1 POSITION(12),
c2,
c3
)
-------------数据加载器执行-----
sqlldr scott/tiger direct=true control='filepath'
为了执行每个条件,我们需要为每个条件放置 POSITION(1) 到 POSITION(9) 标签。否则 ctl 文件不读取标记并忽略条件
我一直在尝试根据某些条件从 csv 文件加载一些数据,但我受到在 when 子句 (Oracle ctl) 中使用 "OR" 控件的限制 前 11 个条件加载数据,但在前 11 个条件后不加载任何数据
以下是代码示例
create table t1 (
c1 varchar(10),
c2 varchar(10),
c3 varchar(10)
)
------------数据加载器------------
options(errors=20000)
LOAD DATA
INFILE 'D:\Scripts\abc.csv'
BADFILE 'D:\Scripts\abc.BAD'
DISCARDFILE 'D:\Scripts\abc.DIS'
DISCARDMAX 20000
insert
INTO TABLE t1
when c1='James'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1,
c2,
c3
)
INTO TABLE t1
when c1='John'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1 POSITION(1),
c2,
c3
)
INTO TABLE t1
when c1='Sam'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1 POSITION(2),
c2,
c3
)
.
.
.
INTO TABLE t1
when c1='Mark'
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
c1 POSITION(12),
c2,
c3
)
-------------数据加载器执行-----
sqlldr scott/tiger direct=true control='filepath'
为了执行每个条件,我们需要为每个条件放置 POSITION(1) 到 POSITION(9) 标签。否则 ctl 文件不读取标记并忽略条件