calling stored procedure from shell script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calling stored procedure from shell script.
# 1  
Old 04-20-2005
calling stored procedure from shell script.

Hi All,
This is a very starnge problem I am having. I have a shell script that calls a stored procedure.

Here's my code in shell script:

sqlplus "userid/pwd" @file.sql

and file.sql has the following statement:

exec my_storedProc;

Now, when I execute my shell script, nothing happens, the stored procedure is NOT executed.

But, if I run the same stored procedure not as a script but, do a sqlplus "userid/password" on UNIX, it brings up the sqlplus prompt. Now if I manually type exec myStoredProc; , it runs just fine.

I do not know why it is happening. Also, I am able to run other stored procedures from shell scripts just fine. This is the only stored proceudre that is giving me problem.

FYI, my stored procedures access external tables. I checked permissions on the external tables and they have full access.

Any suggestions will be appreciated.
# 2  
Old 04-21-2005
try the following ...

Code:
sqlplus "userid/pwd" <<!
exec my_storedProc;
!

# 3  
Old 04-21-2005
Quote:
Originally Posted by priyamurthy2005
sqlplus "userid/pwd" @file.sql

and file.sql has the following statement:

exec my_storedProc;

Now, when I execute my shell script, nothing happens, the stored procedure is NOT executed.
How do you know that the stored procedure didn't execute? Are you expecting output? If you are, did you set server output on? If you are not expecting output but rather a transaction to have taken place, is this how you know? If not, you can put a simple insert statement in your SQL script or the stored procedure to see if the transaction took place.

Code:
sqlplus "userid/pwd" <<!
set serveroutput on size 1000000
exec my_storedProc;
!

Quote:
FYI, my stored procedures access external tables. I checked permissions on the external tables and they have full access.
Shouldn't be a problem.

You can also select something from dual to see if you are able to return any rows from you stored procedure.

Thomas

Last edited by tmarikle; 04-21-2005 at 08:26 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. How to Post in the The UNIX and Linux Forums

Calling a Sybase Stored procedure from a UNIX Script

Hi, I am new to shell scripting and Sybase database i need a help that i try to execute a SYBASE stored procedure from a Unix shell script and wanna write the output of the SP into a Text File.somehow i try to find a solution but whwn i try to run the script i am not getting the output file with... (1 Reply)
Discussion started by: Arun619
1 Replies

2. Shell Programming and Scripting

Calling Oracle stored procedure from ksh script

Friends, I'm newbie with ksh so wanting some help.... 1. I'm trying to call oracle stored procedure from ksh script by taking variable value from runtime, feed into script and execute procedure. 2. Put name1 and name2 value from script run replacing $3 & $4 I'm trying to put name1 in... (4 Replies)
Discussion started by: homer4all
4 Replies

3. Shell Programming and Scripting

Run stored procedure from shell script

Hello all, I am trying to run stored procrdure from shell script which takes one argument. And also I want to verify in the script whether the script executed successfully. However the Stored procedure is not running from shell script. Manually if I run it update the data in the table. Can... (29 Replies)
Discussion started by: PriyaSri
29 Replies

4. Shell Programming and Scripting

How to get OUT parameter of a stored procedure in shell script?

I am invoking a SQL script from shell script. This SQL script will invoke a stored procedure(which has the OUT parameter). I want to have the OUT parameter in the shell script as a variable. Is this possible? (6 Replies)
Discussion started by: vel4ever
6 Replies

5. Shell Programming and Scripting

How to execute the stored procedure from shell script

How to execute the stored procedure from shell script and is there any possibility to print the dbms output in a log file. (2 Replies)
Discussion started by: dineshmurs
2 Replies

6. UNIX for Dummies Questions & Answers

Calling stored procedure from unix

Hi, My stored procedure returns a value. How to retrieve the value and display in unix. Stored procedure CREATE OR REPLACE PROCEDURE gohan(num INT) IS BEGIN DBMS_OUTPUT.PUT_LINE('My lucky number is ' || num); END; Unix Scripting i used sqlplus -s... (7 Replies)
Discussion started by: gohan3376
7 Replies

7. Shell Programming and Scripting

calling a PL/SQL stored procedure from KSH

Hi I have a stored procedure which should be called from KSH. Could ayone please help me with this. Thanks (1 Reply)
Discussion started by: BlAhEr
1 Replies

8. Shell Programming and Scripting

Calling an Oracle Stored Procedure from Unix shell script

hai, can anybody say how to call or to execute an oracle stored procedure in oracle from unix... thanks in advance.... for ur reply.... by, leo (2 Replies)
Discussion started by: Leojhose
2 Replies

9. Shell Programming and Scripting

Calling stored procedure from shell script

HI, I have a similar problem to thread 18264, only I couldn't get it to work. https://www.unix.com/showthread.php?t=18264 I have a stored procedure which is called by a shell script program. When I run the stored procedure alone or through the shell script, it works fine with output text... (3 Replies)
Discussion started by: dorisw
3 Replies

10. Shell Programming and Scripting

Calling MYSQL Stored Procedure?

Hi, Can anyone help me with the correct syntax to call a MYSQL stored procedure from a shell script. I have tried the following, (no input params): /usr/bin/mysql -uadmin -ppassword call TL_CLENSEDATA(); resulting in error: /home/hosting/data/scripts/dbclense.sh: line 12: syntax error... (3 Replies)
Discussion started by: kshelluser
3 Replies
Login or Register to Ask a Question