Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Calling SQL*Plus and Run Procedure in UNIX script, How ?

RE: Calling SQL*Plus and Run Procedure in UNIX script, How ?

From: Kempf, Reed <rkempf_at_rightnow.com>
Date: Thu, 29 Nov 2001 16:48:48 -0800
Message-ID: <F001.003D15B8.20011129163018@fatcity.com>

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: chinman_at_optonline.net

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: ListGuru_at_fatcity.com (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: rkempf_at_rightnow.com
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: ListGuru_at_fatcity.com (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). Received on Thu Nov 29 2001 - 18:48:48 CST

Original text of this message

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