Solved

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

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

831 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