Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL loader unix script with multiple files

Re: SQL loader unix script with multiple files

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Tue, 2 Jan 2007 14:49:28 +0100
Message-ID: <459a6286$0$49208$14726298@news.sunsite.dk>

<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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US