Solved

Run Oracle stored procedure from linux

Posted on 2014-02-06
4
1,325 Views
Last Modified: 2014-02-06
I have a stored procedure that I need to run from linux, from the command line, through a script.  How can I do so?
0
Comment
Question by:newtoperlpgm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 200 total points
ID: 39840406
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
 

Author Comment

by:newtoperlpgm
ID: 39840418
Don't I need to have a shell script or something of the sort setting the directories etc?
0
 
LVL 22

Accepted Solution

by:
Steve Wales earned 300 total points
ID: 39840432
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
 

Author Comment

by:newtoperlpgm
ID: 39840493
This is what I was looking for.  Thanks.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question