Robert,

Here is an example of logging into sql plus and running a stored procedure.
I pass 3 variables to my stored procedure.  This is alot more to my shell
script than this but this will hopefully get you what you want.  I pass $1,
$2, and $3 on the command line (separated by spaces) when I execute my
script.

#!/bin/ksh 
export ORACLE_SID=<your sid>
export ORACLE_BASE=<your base>
export ORACLE_TERM=vt100
export ORACLE_HOME=<your home>
export PATH=$PATH:$ORACLE_HOME/bin

ID=$1
START_VAL=$2
END_VAL=$3

# Log into sqlplus and run the pl/sql procedure
sqlplus -s sitemon/sitemon > /dev/null 2>&1 << END
  set pagesize 0 echo off feedback off heading off verify off
  exec request_times(${ID},'${START_VAL}','${END_VAL}');
exit;

END

HTH

ReedK

-----Original Message-----
Sent: Thursday, November 29, 2001 3:30 PM
To: Multiple recipients of list ORACLE-L


In UNIX shell script: How does one invoke SQL*Plus, pass a shell variable
to run a stored procedure ?
i.e. if you have a UNIX variable $my_table (= dept)
how do you invoke sql*plus and pass $my_table to a procedure
which you'd otherwise manually run in sql*plus as

SQL> exec check_table('dept')

Thanks very much !
Robert Chin

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Robert Chin
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Kempf, Reed
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to