Solved

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

Posted on 2012-04-03
2
980 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 77

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

821 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