Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How do you pass a value from a shell script into a sqlplus script?
"Mike J" <mjjwestford_at_hotmail.com> wrote in message news:<ur885v82jtbt45_at_corp.supernews.com>...
> I gather parameter values in a korn shell script and want to use them in a
> sqlplus script that is called from the shell script. How do you pass a value
> into the sqlplus script?
schema=$1
password=$2
echo "running my program" >myprog$$.log
date >>myprog$$.log
sqlplus -s <<eof > myprog$$.log 2>&1
$schema/$password
-- Do whatcha want, might hafta escape dollar signs sometimes.
eof
or
echo "Enter year \c"
read year
echo "Enter period \c"
read per
echo "$schema/$password
insert into your_table (year, period, created) values ($year,$per,sysdate);
" | sqlplus > /dev/null
Or pass parameters the way the other posters do.
jg
-- @home.com is bogus see http://www.orafaq.com for other faqqy stuff.Received on Mon Oct 21 2002 - 19:11:20 CDT
![]() |
![]() |