Solved

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

Posted on 2006-07-19
4
1,326 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

776 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