how to pass the values to unix shell from the oracle stored procedure.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to pass the values to unix shell from the oracle stored procedure.
# 1  
Old 02-24-2010
how to pass the values to unix shell from the oracle stored procedure.

Hi

i am calling a stored procedure from unix shell like this call

test_proc('0002','20100218');

the stored procedure was giving output

like this dbms_output.put_line(' processed earlier');

i want to see the output in the unix shell where i called.

Thanks
barani
# 2  
Old 02-24-2010
Try:

Code:
var=`sqlplus -s user/pass@conn_string <<EOF
set feedback off
execute test_proc('0002','20100218');
exit;
EOF
`
echo $var


Last edited by dennis.jacob; 02-24-2010 at 01:10 PM.. Reason: mistake corrected..
# 3  
Old 02-24-2010
hi its not working.
# 4  
Old 02-24-2010
Quote:
Originally Posted by barani75
hi its not working.
Are you getting any error? What is the error? Have you checked your s.proc? Is it returing values?
# 5  
Old 02-24-2010
Quote:
Originally Posted by barani75
hi its not working.
That's funny.
It's like saying "My car won't start. What's the problem?"
There could be gazillion different problems. You'll have to give us the details so we can help you. Help us help you.
Otherwise we can only make wild guesses. Or maybe a few could gaze at the crystal ball and somehow read your mind.

Btw, hope you've used "sqlplus -s user/password@conn_string <<EOF" in the script posted earlier.

tyler_durden
# 6  
Old 02-24-2010
call stored procedure

consider this my stored procedure

Code:
create procedure proc(name IN varchar, age IN varchar) 
as 
var varchar;

begin

select * into var from table where colname='name'

if sqlorwcount =0

dbms_output.put.line('name doesnot exit' );

end;


from unix i am calling the procedure like this


Code:
call proc('abc',''ten);


i could not able to find the output after executing the unix script.

Thanks

Last edited by pludi; 02-24-2010 at 10:39 AM.. Reason: code tags, please...
# 7  
Old 02-24-2010
If you are expecting output from a dbms_output.put.line command, make sure you have
Code:
SET SERVEROUT ON

amongst your sqlplus commands.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to run Oracle stored procedure from UNIX env

Hi Everyone, I want to create a script where i need to run the oracle stored procedure from unix script and get the output(sequence number ) into a variable which i will pass in my datastage job. Below is my stored procedure:- DECLARE P_TRANSTYPE VARCHAR2(20); ... (4 Replies)
Discussion started by: prasson_ibm
4 Replies

2. Shell Programming and Scripting

How to Pass the Output Values from the PL/SQL Procedure to Shell Script?

hi, Could anyone tell me how to pass the output values of the PL/SQL procedure to Shell script and how to store that values in a shell script variable... Thanks in advance... (5 Replies)
Discussion started by: funonnet
5 Replies

3. Shell Programming and Scripting

Call and redirect output of Oracle stored procedure from unix script

Hi, Can you assist me in how to redirect the output of oracle stored procedure from unix script? Something similar to what i did for sybase isql -U$MYDBLOG -D$MYDBNAME -S$MYDBSVR -P$MYDBPWD -o$MYFILE<< %% proc_my_test 8 go %% Thanks in advance - jak (0 Replies)
Discussion started by: jakSun8
0 Replies

4. Shell Programming and Scripting

how to call oracle stored procedure from unix shell

Hi i want to call a oracle stored procedure from unix (using bash shell). consider this is my oracle stored procedure with parameter create procedure testproc(name IN varchar, age IN Number, id OUT Number ) AS begin id=1; dbms_output.put.line('successfull validation') end;... (6 Replies)
Discussion started by: barani75
6 Replies

5. Shell Programming and Scripting

how to store the return values of stored procedure in unix shell script.

hi i am calling a oracle stored procedure(in the database) from unix shell scripting (a.sh). the called stored procedure returns some values through OUT variables i want to assign the return values of stored procedure in to unix shell script variable. can you provide me the code. ... (1 Reply)
Discussion started by: barani75
1 Replies

6. Shell Programming and Scripting

Invoking Oracle stored procedure in unix shell script

Here's a shell script snippet..... cd $ORACLE_HOME/bin Retval=`sqlplus -s <<eof $TPDB_USER/april@$TPD_DBCONN whenever SQLERROR exit 2 rollback whenever OSERROR exit 3 rollback set serveroutput on set pages 999 var status_desc char(200) var status_code... (1 Reply)
Discussion started by: hidnana
1 Replies

7. 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

8. UNIX for Dummies Questions & Answers

how to pass values from oracle sql plus to unix shell script

how to pass values from oracle sql plus to unix shell script (2 Replies)
Discussion started by: trichyselva
2 Replies

9. Shell Programming and Scripting

Shell arrays in oracle stored procedure

Is it possible to pass unix shell arrays in Oracle stored procedure? Is yes, how? Thanks (6 Replies)
Discussion started by: superprogrammer
6 Replies

10. Shell Programming and Scripting

Execute an Oracle stored procedure from a shell scrip

Here is a snippet of my code: if then echo "\n Deleting all reports older than 24 hours. \n" >> $logfile ls -l $FileName >> $logfile ... (1 Reply)
Discussion started by: mh53j_fe
1 Replies
Login or Register to Ask a Question