Home » RDBMS Server » Server Utilities » SQLLDR: Delimiter included in textfield
SQLLDR: Delimiter included in textfield [message #110057] Thu, 03 March 2005 03:15 Go to next message
horizon
Messages: 4
Registered: March 2005
Junior Member
Hello,

is there a way to "escape" the field delimiter character within the fields that it is not interpreted as the field delimiter?

Example:
Delimiter: '|'
Text: Field1|Field2 constaining | within| Field3|<endrec>
Re: SQLLDR: Delimiter included in textfield [message #110074 is a reply to message #110057] Thu, 03 March 2005 06:06 Go to previous messageGo to next message
Frank Naude
Messages: 4580
Registered: April 1998
Senior Member
Put the field in quotes and use the following syntax (control file):

...
fields terminated by "|" optionally enclosed by '"' 
...


For more details, see the Oracle Utilities Users Guide.

Best regards.

Frank
Re: SQLLDR: Delimiter included in textfield [message #110089 is a reply to message #110057] Thu, 03 March 2005 07:55 Go to previous messageGo to next message
horizon
Messages: 4
Registered: March 2005
Junior Member
Hello,

thanks for the fast answer. I already tried this but it doesn't work in a line like:

Field1|Field2 constaining "|" within| Field3|<endrec>
Re: SQLLDR: Delimiter included in textfield [message #110091 is a reply to message #110089] Thu, 03 March 2005 07:56 Go to previous messageGo to next message
horizon
Messages: 4
Registered: March 2005
Junior Member
Sorry,
first thinking the writing. The line is:

"Field1"|"Field2 constaining "|" within"|" Field3"|<endrec>
Re: SQLLDR: Delimiter included in textfield [message #110136 is a reply to message #110089] Thu, 03 March 2005 12:14 Go to previous messageGo to next message
Frank Naude
Messages: 4580
Registered: April 1998
Senior Member
The syntax is:

Field1|"Field2 containing | within"|Field3|<endrec>

Best regards.

Frank
Re: SQLLDR: Delimiter included in textfield [message #110209 is a reply to message #110136] Fri, 04 March 2005 02:53 Go to previous messageGo to next message
horizon
Messages: 4
Registered: March 2005
Junior Member
Hello,

if the substring "|" is included between the field delimiters "|" (with optinal enclosed '"') the problem isn't solved, just shifted.

Kind regards
Re: SQLLDR: Delimiter included in textfield [message #110303 is a reply to message #110209] Sat, 05 March 2005 04:39 Go to previous message
Frank Naude
Messages: 4580
Registered: April 1998
Senior Member
What do you mean the problem is shifted? Can't you just test it?

SQL> CREATE TABLE test (f1 varchar2(30), f2 varchar2(30), f3 varchar2(30));

Table created.


$ cat test.ctl
load data
  infile *
  into table test
  fields terminated by "|" optionally enclosed by '"'
  (f1, f2, f3)
begindata
Field1|"Field2 containing | within"|Field3|


$ sqlldr scott/tiger control=test.ctl

SQL*Loader: Release 10.1.0.2.0 - Production on Sat Mar 5 12:08:43 2005

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

Commit point reached - logical record count 1


SQL> SELECT * FROM test;

F1                             F2                             F3
------------------------------ ------------------------------ ------------------------------
Field1                         Field2 containing | within     Field3


Best regards.

Frank
Previous Topic: Export from 9i to 8.05 exp00054 error
Next Topic: using sqlloader to loading xml file
Goto Forum:
  


Current Time: Wed Jul 03 09:24:49 CDT 2024