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: How do you pass a value from a shell script into a sqlplus script?

Re: How do you pass a value from a shell script into a sqlplus script?

From: Joel Garry <joel-garry_at_home.com>
Date: 21 Oct 2002 17:11:20 -0700
Message-ID: <91884734.0210211611.35adfc8a@posting.google.com>


"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

Original text of this message

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