Question

I am loading a dataset into a oracle database via SQL Loader.
The ctl files looks like this:

OPTIONS (DIRECT=TRUE)  
LOAD DATA   
CHARACTERSET WE8MSWIN1252   
INFILE test.csv  
 TRUNCATE  
 CONTINUEIF NEXT(1:1) = '#'  
 INTO TABLE FIETSKNOOPPUNTEN_A  
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '$$'   
TRAILING NULLCOLS   
(CODE,  
STREET,  
MUNICIPALITY,  
X,  
Y)

The records look like this:

70.00|Hogeweg|Aardenburg|18370.00|366787.00

Using SQL Loader all records are loaded and no error occur. All decimal places are ignored, but also of the first column the first character is skipped. In this case, the database shows that this record has a code of 0 instead of 70. When I place a space in front of the record in the csv file everything works fine.
I have tried several things such as recreating the file via MS Access, removing the OPTIONS and CHARCACTERSET clause in the ctl file, but I am stuck now.

Any Ideas? Thanks.

Was it helpful?

Solution

I'm pretty sure the first character is used to evaluate your CONTINUEIF clause. It is evaluated on each and every row and this first character is used exclusively for this clause.

Presumably, you are not using the feature enabled by CONTINUEIF (dynamically concatenate multiple distinct rows into a single logical record). Dropping this clause should solve your skipped first character problem.

OTHER TIPS

I wonder if it is the use of CONTINUEIF NEXT(1:1) = '#' that is causing this. If SQL*Loader is checking for the first character being # maybe it is then continuing from the second character? Try changing it to CONTINUEIF NEXT PRESERVE (1:1) = '#'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top