OK, I've cleaned it up, compiled it, using olu's help.
olus, your help was great, but I need to call SQLplus on the sql files and SQL*Loader with the ctl files, but it was the guidance I needed (as well as the kick in the rear ;)
Thanks again for the help folks.
my $workDir = './whatever'; my $oraLogin = 'user/password\@database'; my @filesToLoad = ( { "FileName" => 'datfile.dat',"FileLoc" => 'filedir',"OKFile" => "O +K.htm"}); chdir($workDir); foreach my $fileToLoad (@filesToLoad) { my $fileToLoadPath = "$workDir/$fileToLoad{'FileLoc'}"; my $dataFile = "$fileToLoadPath/$fileToLoa{'FileName'}"; my $okFile = "$fileToLoadPath/$fileToLoad{'OKFile'}"; if ($fileToLoad{'OKFile'}!="NO" && -e $dataFile ) { #remove OK file if (-e $okFile) {rm("$okFile");} #load available files opendir CTLDIR, $fileToLoadPath; my @allFiles = readdir(CTLDIR); closedir CTLDIR; # build array of files my @ctlFiles = grep {/\.run_ctl/i} @allFiles; my @sqlFiles = grep {/\.run_sql/i} @allFiles; #execute the files SQLloader($fileToLoadPath, \@ctlFiles); SQLplus ($fileToLoadPath, \@sqlFiles); } } sub SQLloader { my $path = shift; my $fileList = shift; foreach my $file (@{ $fileList }) { system("sqlldr $oraLogin control=$path/$file rows=10000 error +s=99999 $path/sqlldr.log"); } } sub SQLplus { my $path = shift; my $fileList = shift; foreach my $file (@{ $fileList }) { system("sqlplus $oraLogin \@$path/$file"); } }
In reply to Re: Anyone want to compress this a little more?
by Anonymous Monk
in thread Anyone want to compress this a little more?
by naveed010
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |