Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-07-19
4
Medium Priority
?
1,446 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
2 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 1000 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 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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…
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.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

810 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