Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Sirisha.

Asked: July 28, 2017 - 4:29 pm UTC

Last updated: April 25, 2019 - 11:54 pm UTC

Version: 11g

Viewed 10K+ times! This question is

You Asked

Hi

Can I load a file using sqlloader within a batch file where the file name changes dynamically.

Eg: The file name is FUNC_DDMMYY.csv

Can I load this file by passing it to SQLLoader as FUNC_*.csv?

Would wild cards work in this case. How can I implement this.

Many Thanks
Sirisha

and Connor said...

Options

1) use an external table instead. Lots more flexbility there,

https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:37593123416931

2) Use a scripting language, for example, your control file could be:

LOAD DATA
INFILE @@MYFILE@@.csv
etc etc

and then you would (for example) 'sed' to do:

sed 's/@@MYFILE@@/func_020360/g' control_file.template > control_file.ctl


Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

How do you generate file name to be used in sed

A reader, April 19, 2019 - 4:41 am UTC

How do you generate file name to be used in sed
Connor McDonald
April 25, 2019 - 11:54 pm UTC

Not sure what you mean. They already *know* the file name - they want to use it in SQL Loader.

More to Explore

Utilities

All of the database utilities are explained in the Utilities guide.