Automate SQL LOADER in UNIX environment [message #194061] |
Wed, 20 September 2006 11:12 |
swisstar
Messages: 2 Registered: September 2006 Location: Canada
|
Junior Member |
|
|
Hi,
We are using Oracle 9i in Unix environment. We want to automate sql loader through UNIX scripting. Here is the scenario:
Data files in csv format come on the network drive on daily basis with a different file name everyday for example:
test_sep20_2006.csv
test_sep21_2006.csv ...
So soulution would be, to first check the existence of the data file for the current day and then automatically picks the data file (data file names are different everyday therefore we can not hardcode the data file in the control file).
Any help would be much appreciated.
Regards
|
|
|
Re: Automate SQL LOADER in UNIX environment [message #194114 is a reply to message #194061] |
Wed, 20 September 2006 17:10 |
kimant
Messages: 201 Registered: August 2006 Location: Denmark
|
Senior Member |
|
|
If You really want to do this in Unix, this is not really a question about Oracle technology.
You would perhaps create a parameter file with the columns etc., and then the shell variables for the filename.
This is really a question to a Unix/shell developer.
Another approach would be to use external tables, where You use utl_file or even Java to test if the file are there, then define the external table, load from it and then perhaps drop it again.
Br
Kim
|
|
|
|
Re: Automate SQL LOADER in UNIX environment [message #194369 is a reply to message #194061] |
Thu, 21 September 2006 13:54 |
Anjumc
Messages: 2 Registered: September 2006
|
Junior Member |
|
|
How about this..
This is just an example you can modify this..
ls ~/*.csv|grep `date|awk '{print $2"_"$3"_"$6}'` 1>/dev/null 2>/dev/null
if [ "$?" = "0" ]
then
ls ~/*.csv|grep `date|awk '{print $2"_"$3"_"$6}'`
echo "File exists"
else
echo "No file"
fi
|
|
|
|