Solved

sqlldr- combine and insert two values - position(1:10) and position(20:30)  into one column

Posted on 2012-04-03
2
937 Views
Last Modified: 2012-04-03
i have to load a text file into oracle table using sqlldr.
I want to load characters from position(1:10) and position(20:30) into one column into my oracle table
I donot want to load characters from 10-20 since they are some invalid charactesr(like carriage returns etc) and it messes up my dataload of characters from position-20:30)
 
How can i do that using sqlldr
I tried
options( SKIP = 0 )
load data
infile 'myfile.txt' "str '\n'"
insert INTO
Table mytable
TRAILING NULLCOLS
 (  
allcols    position(1:10,20:30)  
 )

but that failed, I also tried using || concatenator but it did not work
pl help
0
Comment
Question by:at999
2 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 37803440
use boundfiller.

Here is a working example:

drop table tab1 purge;
create table tab1(col1 varchar2(10));

Open in new window


OPTIONS ( DIRECT=TRUE)
LOAD DATA
INFILE *
INTO TABLE TAB1
APPEND
FIELDS TERMINATED BY ','
(
part1 boundfiller position(1:3),
part2 boundfiller position(8:12),
col1  ":part1 || :part2"
)
begindata
abcdefghijklmnop

Open in new window

0
 

Author Closing Comment

by:at999
ID: 37803846
thanks a lot its working
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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Repeat query 13 46
Help on model clause 5 31
Oracle DBLINKS From 11g to 8i 3 34
run sql script from putty 4 35
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…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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
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.

773 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