Re: help with batch operation

  • From: Yechiel Adar <adar666@xxxxxxxxxxxx>
  • Date: Wed, 09 Sep 2009 08:06:35 +0300

In the first option I forgot to write the sqlplus command between the copy and the move.

Adar Yechiel
Rechovot, Israel

Yechiel Adar wrote:
I read the replies and I assume that all the files are in the same structure as you are reading them using the same external table.
You have several options:
1) If you can process the data from all the files in the same time AND have disk space
    you can use:
    copy a.txt+b.txt+c.txt target.txt
move *.txt archive\*.old /Y -->move the files and rename them to old, overwrite existing files in archive. this will give you one big file, target.txt, that is concatenation of all the files and you can process that.
2) Use the for command.
    for %i in (*.txt) do call process_file %1
    and create file call_process.cmd that do:
copy %1 target.txt --> I prefer copy as the original file remains a is in case of problems, you can use rename.
    sqlplus whatever
move %1 archive\%1 /Y --> move the file to archive directory and overwrite old file with that name
Adar Yechiel
Rechovot, Israel

Eugene Pipko wrote:

Hi all,

Running Oracle 9.2 on Windows.

I know this is Oracle forum, but it's somewhat related. This question is for those of you who run Oracle on Windows.

I have several ".txt" files in a directory (all different names) and looking for the possibility to do the following using .BAT file:

1.       Take first file

2.       rename it

3.       run procedure (pass it in)

4.       move it into archive dir

5.       delete it from original dir

6.       GOTO 1

Reason I have to do all this is because in step 3 I am using external table to read the ".txt" file and it has to have a unique file name.


Eugene Pipko

Seattle Pacific Industries

office: 253.872.5243

cell: 206.304.7726

P  Please consider the environment before printing this e-mail.

Other related posts: