slicendice
Programmer
Hi
I have a scenario whereby I need to load data into a table using SQL*Loader. The fields are pipe seperated and one of the fields contains text that may be split onto several lines.
The target table is defined as:
Each record in the source file has a blank field at the end and therefore there is a pipe character at the end of every record. So an example of how the data looks in the source file is:
So the first record has field three split over several lines. I'm using CONTINUEIF in the control file in order to handle this, as follows:
Now this is working OK up to a point - it successfully reads the multi-line field and loads it into the appropriate field in the target table, but in doing so it loses the CR/LF's and hence the data is all crammed onto one line.
Does anyone know how I can preserve the CR/LF characters so that they get imported into the table? I've tried using the PRESERVE keyword but it doesn't make any difference
Thanks very much
I have a scenario whereby I need to load data into a table using SQL*Loader. The fields are pipe seperated and one of the fields contains text that may be split onto several lines.
The target table is defined as:
Code:
COL1 NUMBER(8)
COL2 VARCHAR2(10)
COL3 VARCHAR2(500)
COL4 NUMBER(1)
Each record in the source file has a blank field at the end and therefore there is a pipe character at the end of every record. So an example of how the data looks in the source file is:
Code:
1|abc|one
two
three
four|1|
2|def|five six seven|2|
So the first record has field three split over several lines. I'm using CONTINUEIF in the control file in order to handle this, as follows:
Code:
LOAD DATA
INFILE 'test1.csv'
BADFILE 'test1.bad'
DISCARDFILE 'test1.dsc'
TRUNCATE
CONTINUEIF LAST <> '|'
INTO TABLE table1
FIELDS TERMINATED BY "|"
TRAILING NULLCOLS
(
col1 INTEGER EXTERNAL,
col2 CHAR,
col3 CHAR,
col4 INTEGER EXTERNAL
)
Now this is working OK up to a point - it successfully reads the multi-line field and loads it into the appropriate field in the target table, but in doing so it loses the CR/LF's and hence the data is all crammed onto one line.
Does anyone know how I can preserve the CR/LF characters so that they get imported into the table? I've tried using the PRESERVE keyword but it doesn't make any difference
Thanks very much