Keyword error with SQL*Loader and generated control file

347 views Asked by At

I am a creating control file dynamically when my shell script runs, with:

echo 'LOAD DATA'                             > $CTLDIR/test.ctl
echo 'TRUNCATE'                              >> $CTLDIR/test.ctl
echo 'INTO TABLE TEMP'                       >> $CTLDIR/test.ctl
echo 'FIELDS TERMINATED BY ","'              >> $CTLDIR/test.ctl
echo 'TRAILING NULLCOLS'                     >> $CTLDIR/test.ctl
echo '('                                     >> $CTLDIR/test.ctl
echo 'NO, '                                  >> $CTLDIR/test.ctl
echo 'I_NUM , '                              >> $CTLDIR/test.ctl
echo 'QTY  , '                               >> $CTLDIR/test.ctl
echo 'CREATE_DATETIME       SYSDATE'         >> $CTLDIR/test.ctl
echo ')'                                     >> $CTLDIR/test.ctl

When I execute my shell script I get error "Expected keyword INTO, found keyword LOAD."

Please help me in resolving this.

1

There are 1 answers

3
Edward Orlowski On

Your controlfile looks OK. How are you using SQL*Loader?

You could start it with a command like this:

sqlldr control=$CTLDIR/test.ctl userid=[username]/[password]@[connect string]