• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1635
  • Last Modified:

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?
  • 2
2 Solutions
create a script like this...

exec procedure_owner.procedure_name(param1,param2);

Open in new window

to execute the script

sqlplus username/password@yourdb  @your_script

Open in new window

newtoperlpgmAuthor Commented:
Don't I need to have a shell script or something of the sort setting the directories etc?
Steve WalesSenior Database AdministratorCommented:
You can call that from a shell script:

Something like this ?

export ORACLE_HOME=/u01/app/product/11.2.0/dbhome_1
export ORACLE_SID=yourdb
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.
newtoperlpgmAuthor Commented:
This is what I was looking for.  Thanks.
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.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now