Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-03-20
1
Medium Priority
?
1,056 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 500 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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
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…

604 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