Home » Infrastructure » Unix » How to pass an input file which has date included in it and it keeps changing when sqlloading (sqlldr and unix script)
icon5.gif  How to pass an input file which has date included in it and it keeps changing when sqlloading [message #553669] Mon, 07 May 2012 13:52 Go to next message
dora
Messages: 13
Registered: January 2012
Junior Member
Hi

I am running the control file in unix,

sqlldr abcdata@DUMMY/daddy control=loadThirdPartyTest.ctl data=$OUTDIR/'THIRD_PARTY.20120507.txt'



The input file, THIRD_PARTY.20120507.txt will change its name every day with a new date.
I have tried the input file name, as THIRD_PARTY.*.txt, and it doesnot recognise *.

Anyhelp is appreciated.Thank You.
Re: How to pass an input file which has date included in it and it keeps changing when sqlloading [message #553670 is a reply to message #553669] Mon, 07 May 2012 14:07 Go to previous messageGo to next message
BlackSwan
Messages: 22728
Registered: January 2009
Senior Member
export TODAY=20120107
sqlldr abcdata@DUMMY/daddy control=loadThirdPartyTest.ctl data=$OUTDIR/${TODAY}.txt

just establish environmental variable correctly prior to invoking sqlldr


Re: How to pass an input file which has date included in it and it keeps changing when sqlloading [message #553672 is a reply to message #553669] Mon, 07 May 2012 14:13 Go to previous messageGo to next message
Michel Cadot
Messages: 58959
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
it doesnot recognise *.


Remove the '.
Or better put the date in a variable.
CURDATE=`date +'%Y%m%d'`.

Regards
Michel
Re: How to pass an input file which has date included in it and it keeps changing when sqlloading [message #553673 is a reply to message #553672] Mon, 07 May 2012 14:28 Go to previous messageGo to next message
dora
Messages: 13
Registered: January 2012
Junior Member
Hi Sir,

The Input file for example, as said earlier is THIRD_PARTY.20120507.txt
comes in today, as the date added to the input file name is today,

But i didnot run the unix script containing the sqlldr today, instead
I will run it tommorrow.
The file contains yesterday's date on it.

In that situation, how do i consider the input file to load data using the sqlldr from unix.

Note: The input files come on certain occassions, I might not run the sqlldr the day we get input files.
Note: Every input file name contains first part of the name same, but the date difference based on when it comes.

Thank You.
Re: How to pass an input file which has date included in it and it keeps changing when sqlloading [message #553674 is a reply to message #553673] Mon, 07 May 2012 14:34 Go to previous messageGo to next message
BlackSwan
Messages: 22728
Registered: January 2009
Senior Member
Your problem & solution have NOTHING to do with Oracle.
Problem is routine *NIX scripting issue.
Re: How to pass an input file which has date included in it and it keeps changing when sqlloading [message #553843 is a reply to message #553674] Tue, 08 May 2012 15:47 Go to previous message
andrew again
Messages: 2574
Registered: March 2000
Senior Member
$ sqlldr / t data=`ls -tr PDNL*.dat | tail -1`

http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:15669761931545#15681732952906


Previous Topic: oracle 10g installation problem in RHEL 6
Next Topic: Script for retrieving the Transaction IDs through a Shell Script
Goto Forum:
  


Current Time: Tue Sep 02 16:21:06 CDT 2014

Total time taken to generate the page: 1.91819 seconds