Run Oracle stored procedure from linux

I have a stored procedure that I need to run from linux, from the command line, through a script.  How can I do so?
newtoperlpgmAsked:
Who is Participating?
 
Steve WalesConnect With a Mentor Senior Database AdministratorCommented:
You can call that from a shell script:

Something like this ?

#!/bin/bash
export ORACLE_HOME=/u01/app/product/11.2.0/dbhome_1
export ORACLE_SID=yourdb
export ORAENV_ASK=NO
export PATH=$PATH:/usr/local/bin

. /usr/local/bin/oraenv

$ORACLE_HOME/bin/sqlplus username/password@yourdb  @your_script

Open in new window


Setting ORACLE_SID isn't really necessary since ststuber declared the @yourdb in the call.

If you set ORACLE_SID in the script you don't need to specify @yourdb in the call.
0
 
sdstuberConnect With a Mentor Commented:
create a script like this...

exec procedure_owner.procedure_name(param1,param2);
exit

Open in new window



to execute the script

sqlplus username/password@yourdb  @your_script

Open in new window

0
 
newtoperlpgmAuthor Commented:
Don't I need to have a shell script or something of the sort setting the directories etc?
0
 
newtoperlpgmAuthor Commented:
This is what I was looking for.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.