Dynamic control file generation in WINDOWS Environment [message #467330] |
Fri, 23 July 2010 07:29 |
varunendra
Messages: 4 Registered: July 2010 Location: India
|
Junior Member |
|
|
Hello Friends,
I am trying to generate dynamic control file, as the files I want to upload are coming from different source and their name is constantly changing but following a fix pattern and naming convention.
I am able to generate dynamic control file through SQL. But while calling from BATCH file, i am unable to sent the file name as parameter.
All the examples i have searched are for UNIX, pls help me how to do it with BATCH File in WINDOWS.
|
|
|
|
|
Re: Dynamic control file generation in WINDOWS Environment [message #474460 is a reply to message #467350] |
Mon, 06 September 2010 10:27 |
varunendra
Messages: 4 Registered: July 2010 Location: India
|
Junior Member |
|
|
Hi all, I am able to find the solution of my problem.
What I am doing now is to generate control file dynamically by using ECHO option of DOS.
its shown as below -
echo OPTIONS ( ERRORS=10000000) > abc.ctl
echo load data >> abc.ctl
remark - the below lines read all txt file in directory and passes there name to abc.ctl control file.
for /f %%a IN ('dir /b D:\a\*.txt') do echo INFILE 'D:\a\%%a' >>abc.ctl
echo
echo append INTO TABLE tablename>>abc.ctl
echo fields terminated by '+' >>abc.ctl
echo ( >>abc.ctl
feild1,field2,field3) >>flat.ctl
sqlldr userid = USERNAME/PWD@DBNAME
control=abc.ctl
CM: replaced colour tags with code tags
[Updated on: Mon, 06 September 2010 10:34] by Moderator Report message to a moderator
|
|
|
|