Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Using environment variable in sqlloader
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
![]() |
![]() |