Home » SQL & PL/SQL » SQL & PL/SQL » SQLLDR SCRIPT
SQLLDR SCRIPT [message #202599] Fri, 10 November 2006 08:51 Go to next message
bah112564
Messages: 2
Registered: November 2006
Location: Mechanicsburg, Pennsylvan...
Junior Member
I have an ORACLE 10g table I would like to load via sqlldr. I have the control file and the data file and am able to load this table from the command line - sqlldr control=control.ctl and so on. What I want is a simple script that will do the same thing. I need to run this script via Maestro (our scheduling package) so I would probably like some kind of return stating whether the sqlldr worked or failed. Does anyone have a script that does something like this? Any help is greatly aprecaitted.

Thanks.
Re: SQLLDR SCRIPT [message #202614 is a reply to message #202599] Fri, 10 November 2006 09:51 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
You have not mentioned your o/s. Assuming if it is unix you can write a shell script to achieve the same. you will call sqlldr in the shell script and check for the value of "$?" which will give you the exit state of the process. Or you can check for the existence of the bad file and if it is not empty you can decide whether the load is successful. You should add this script name in your maestro job with the corresponding path.

Code will be something like this


<Your initialisation parameters>
sqlldr userid/password control=<appropriate path>control.ctl bad=<appropriate path>badfile.bad data=<appropriate path>datafile.dat

Option 1 :
retval=$?
if [ $retval -ne 0 ]
then
   fatal_error
fi

Option 2:

if ! [ -s badfile.bad ]
then
   fatal_error
fi




HTH
Re: SQLLDR SCRIPT [message #202638 is a reply to message #202614] Fri, 10 November 2006 11:51 Go to previous messageGo to next message
bah112564
Messages: 2
Registered: November 2006
Location: Mechanicsburg, Pennsylvan...
Junior Member
That is exactly what I was looking for. But of course that leads me to a couple more questions.

Just out of curiosity what would the initialization parameters be? Would that be removing the bad file and such?

Thanks in advance.
Re: SQLLDR SCRIPT [message #202774 is a reply to message #202638] Sun, 12 November 2006 04:58 Go to previous message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
It could be anything what you want to do before you want to continue your loading. One xample will be to validate your data file based on your requirements.

cheers

Previous Topic: Alter Type Error
Next Topic: A question about top n values
Goto Forum:
  


Current Time: Fri Dec 09 07:47:41 CST 2016

Total time taken to generate the page: 0.10431 seconds