Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> shell script #! style startup of sql loader
Hello
Does anyone know how to start up sql loader the way sh , ksh, perl and others operate? ie I want to put on the 1st line something like
#!/ora01/app/oracle/product/7.3.2/bin/sqlldr args....... <body of control file>
In fact #! will not work, the best I have been able to do so far is this:
#!/bin/ksh
CTL_DR=/home/ops/stuf/morestuf/MORE
DAT_FL="$CTL_DR/INPUT/datafile"
i=0
# find a filename that does not exist to put # control file to
while :
do
((i = i + 1))
CTL_FL=$CTL_DR/ctl$i.ctl
if [[ -a $CTL_FL ]]
then
continue
else
break
fi
done
# put control file to tmp file
cat 1>$CTL_FL <<EOF
OPTIONS (rows=1000, errors=500, bindsize=20000000)
LOAD DATA
append
INTO TABLE roadrash_s
(abc terminated by ',' enclosed by '"' nullif abc=blanks
, num terminated by ',' enclosed by '"' nullif num=blanks
, date DATE "dd/mm/yyyy" enclosed by '"' nullif date=blanks
, seq_no "nvl(NULL,my_seq.nextval)"
, YorN constant 'N'
, ty_pe constant 1
)
EOF
if [[ -f $CTL_FL ]] # just being pedantically anal
then
sqlldr control=$CTL_FL data=$DAT_FL log=/tmp/log userid=scott/tiger_at_INST
rm $CTL_FL #cleanup your temp control file.
fi
My views are my own, more's the pity I can't afford expensive consultants
to give me smarter views.
(in case you haven't figured it out, this is the std. disclaimer to
let my employer off any hook for my actions. )
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Mar 09 1999 - 21:57:20 CST