Re: Passing args to sqlldr?
Date: 1997/05/29
Message-ID: <m8tdeEAoxcjzEwKg_at_erichome.demon.co.uk>#1/1
In article <psyclopsEAwq2q.1tF_at_netcom.com>, Steve Wertz
<psyclops_at_netcom.com> writes
>For sqlldr (under Unix), I'd like to be able to pass an argument
>into SQL-Loader, and use that argument as the value for a paritcular
>field. Can this be done? The argument would be the first two characters
>of a file name. It would look something like this in a shell script..
>
>for fname in *sales.txt; do
> prefix=`echo $FNAME|cut -c1-2`
> sqlload / loadsales.ctl data=${prefix}sales.txt
>done
>
>I want to be able to pass "prefix" somehow into the control file to use
>as a column value.
>
>Depending on whay my control file eventually looks like, I could probably
>'sed' the control file and change it dynamically for each itteration, but
>I'm looking for a more graceful way to do this (not that I'd know the sed
>syntax anyway ;-)
Just today I was trying to do the same with VMS....spooky. I think creating a dynamic control file is the way to go. You could avoid sed by echoing the lines (including the $prefix) to an output file with >>. Or, run a sqlplus script after the loader, which updates the column(s) with $prefix.
| ~~~~~~~~~~~~~~~~~~~~ | ERIC HARTZENBERG | ~~~~~~~~~~~~~~~~~~~ | | Email : eric_at_erichome.demon.co.uk Compuserve : 100073,21 | | Homepage : www.erichome.demon.co.uk | |________________________________________________________________|Received on Thu May 29 1997 - 00:00:00 CEST