I want to load data from multiple files for a project by executing the script via crontab. The script runs well when executed manually but when the script is executed by crontab routine, the sqlldr does not commit the results but moves to the next iteration, resulting in no data loading.
The sqlldr lines work fine with out the loop.
any help in altering the script so that the desired results are gained will be highly appreciated
Please find Below the code segment
ORACLE_HOME=/oracle/oracle/product/10g/db_1
$ORACLE_HOME/bin/sqlldr
export ORACLE_HOME
totaltotalFileNumber=1000
count=1
while [ $count -lt $totalFileNumber ]
do
$ORACLE_HOME/bin/sqlldr $DBUser/$DBPassword@testdb control=$controlFilePath direct=true parallel=true
count=`expr $count + 1`
done
-----------CTL file content------------
options(errors=20000)
LOAD DATA
INFILE '/settlement/(fileName).unl'
BADFILE '/settlement/(fileName).BAD'
DISCARDFILE '/settlement/(fileName).DIS'
append
INTO TABLE MO_SMSC
FIELDS TERMINATED BY "," optionally enclosed by '"'
Trailing NULLCOLS
(
colA,
colB,
colC,
colD,
colE
)