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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Using environment variable in sqlloader

Re: Using environment variable in sqlloader

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Sun, 21 Mar 1999 13:31:00 +0100
Message-ID: <36f4e686$0$6453@newton>


Magnus Lassi wrote
> WHEN (214:219) = '`echo $MONTH`'

No, you cannot use environment variables in SQL*Loader. You could write a Unix shell script that calls ed or vi to edit a copy of your ctl file, and thus replace $MONTH with the actual value (no need to use the $ in the ctl file; you just need an unique word, like PROCESSMONTH). For example, using vi and a "here-document" (not tested):

    cp my_ctl.ctl temp.ctl
    # start vi and execute a global substitute,     # and exit using write, quit:
    vi temp.ctl << EOF
    /%s/PROCESSMONTH/$MONTH/g
    :wq
    EOF
    sqlload ... temp.ctl ...

If you want to use $MONTH in the ctl file, then replace PROCESSMONTH with \$MONTH.

Arjan. Received on Sun Mar 21 1999 - 06:31:00 CST

Original text of this message

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