I have a requirement to load data from delimited file to Oracle 12c.
My Ctl file looks like below :
OPTIONS (skip=2,rows=1000, bindsize=100000, readsize=100000, discardmax=1, silent=header,feedback)
load data
CHARACTERSET UTF8
insert into table XYZ
WHEN FIELD2 <> ''
fields terminated by '^' optionally enclosed by ','
trailing nullcols
(
FIELD1 filler,
FIELD2,
FIELD3,
MODIFIED_DATE "SYSDATE"
)
In my data file, i am expecting atleast one row with NULL for FIELD2 & FIELD3.
Assume my data file is :
ABC^DEF^GHI
ABC^^
My second record gets discarded as intended , with the below message :
1 Row successfully loaded.
0 Rows not loaded due to data errors.
1 Row not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
However, sqlldr exit code remains 2 , causing my script to fail. Is there a way to load the valid records (rows with FIELD2 as not null) & gracefully success exit ?
Any help is greatly appreciated.
Thanks.