Solved

sql loader control file help..........

Posted on 2007-03-20
1
1,051 Views
Last Modified: 2010-08-05
Hi,

I need help for sql ldr control file -

I need to load data from a file into a table, but need to add a constant to each row -

Here is my control file -

load data
infile '/dev/data_files/MERCH.txt'
truncate
into table tb_load
(DATA_RECORD POSITION(1:621) CHAR)

Above control file works and all data loaded as expected, now, I need to add a constant to each record while loading, so I tried to modify control file as below -

load data
infile '/vend_comp_dev/data_files/DRS_SEASNMERCH_2007031719.txt'
truncate
into table tb_vc_load
(DATA_RECORD CONSTANT '18' || POSITION(1:621) CHAR)

But, above control file gets a syntax error on ||
Can someone help?  How can I add a constant while adding the data file into my table, basically for every record I need constant 18 then data record.

Thanx
cm

0
Comment
Question by:chandukb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
ishando earned 125 total points
ID: 18760769
You only use the CONSTANT when setting a field to a constant value, eg

   DATA_RECORD CONSTANT '18'

if you want to concatenate '18' to the start of the field you would do:
   
  DATA_RECORD POSITION(1:621) CHAR   "'18' || :DATA_RECORD"
or
  DATA_RECORD POSITION(1:621) CHAR   "concat('18',:DATA_RECORD)"
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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 explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
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.

733 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