Solved

How does SQL Loader distinguish between a tab and a space ?

Posted on 2006-07-19
4
1,287 Views
Last Modified: 2012-08-14
I'm trying to load an Oracle table with data from a data file that has tab delimited data using SQL Loader. The table description is as follows :

 Name                                      Null?    Type
 ----------------------------------------- -------- --------------
 EMP_NO                                             NUMBER(3)
 EMP_NAME                                           VARCHAR2(11)
 EMP_JOB                                            VARCHAR2(5)


The control file is as follows :

LOAD DATA
APPEND INTO TABLE EMP
TRAILING NULLCOLS
(
emp_no   CHAR
   TERMINATED BY X'09' OPTIONALLY ENCLOSED BY '"',
emp_name CHAR
   TERMINATED BY X'09' OPTIONALLY ENCLOSED BY '"',
emp_job CHAR
   TERMINATED BY X'09' OPTIONALLY ENCLOSED BY '"'
)

The data file is as follows :

123      "Su Ann"      DBA
234      Benjamin      ABC
321      Alex      WEX

Well, it is loading the 2nd and 3rd rows but not the first. The space between Su and Ann is the reason. The SQL Loader is taking that space as a tab and hence giving an error.

So, how do I tell the loader that there can be spaces in the data that need to be included  ? How would it distinguish between the space and a tab ?

I need an answer. There is no way I can work around this. I tried giving "\t", '     ',where the space is a tab instead of X'09' in the control file. Nothing worked.

I would really appreciate any help.

Thanks in advance.
0
Comment
Question by:Yashwi
4 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 250 total points
ID: 17141990
You are on the right track - I think that you need to escape the characterts - but add the line ESCAPED BY '\\' and then make the unwanted tabs \t
0
 
LVL 14

Assisted Solution

by:sathyagiri
sathyagiri earned 250 total points
ID: 17150855
LOAD DATA
APPEND INTO TABLE EMP

FIELDS TERMINATED BY X'9' TRAILING NULLCOLS
(
emp_no   CHAR,
emp_name CHAR,
emp_job CHAR
)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to take different types of Oracle backups using RMAN.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now