Solved

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

Posted on 2007-03-20
1
1,045 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
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

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.

Join & Write a Comment

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to recover a database from a user managed backup
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now