Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL loader unix script with multiple files
<mnemonic01_at_hotmail.com> wrote in message
news:1167743498.542541.64490_at_k21g2000cwa.googlegroups.com...
> No I'm facing another challenge
>
> the datafile is with every load another one
> name= schemaname_"controlfilename_without_ctl"_loaddate.dat
> so what I'd like to is:
> in the sqlloader syntax load the proper datfile belonging to the
> controlfile, which is available at that moment
> otherwise about a 100 ctl has to be edited every time a load takes
> place to specify the infile
Something like this:
for ctl in "${DATADIR}"/ctl/*.CTL; do
dfdir="${ctl%/*}"
dfname="${ctl##*/}"
sqlldr "${SCHEMA}"/"${SCHEMAPWD}" \
control="$ctl" log="${ctl%.*}" \
datafile="${dfdir}"/schemaname_"${dfname%.*}"_loaddate.dat
done
Or like this:
for ctl in "${DATADIR}"/ctl/*.CTL; do
dfdir="$(dirname $ctl)"
dfname="$(basename $ctl)"
echo sqlldr "${SCHEMA}"/"${SCHEMAPWD}" \
control="$ctl" log="${ctl%.*}" \
datafile="${dfdir}"/schemaname_"${dfname%.*}"_loaddate.dat
done
And if schemaname and loaddate are variables:
for ctl in "${DATADIR}"/ctl/*.CTL; do
dfdir="${ctl%/*}"
dfname="${ctl##*/}"
sqlldr "${SCHEMA}"/"${SCHEMAPWD}" \
control="$ctl" log="${ctl%.*}" \
datafile="${dfdir}"/"${schemaname}"_"${dfname%.*}"_"${loaddate}".dat
done
Regards
Dimitre
Received on Tue Jan 02 2007 - 07:49:28 CST
![]() |
![]() |