Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to execute a stored procedure with an out value in a shell prog

Posted on 2006-06-26
3
Medium Priority
?
389 Views
Last Modified: 2013-12-12
I am trying to execute an oracle stored procedure in a shell script and then using the exit value from the procedure in a IF condition in the shell script. The out parameter is a number, its a s follows, the procedure is called within check_4_data.sql  but is giving me the following error "SP2-0734: unknown command beginning "PDL.FIND_D..." - rest of line ignored. SP2-0103: Nothing in SQL buffer to run."

CODE:

checkdatapdl=`sqlplus -s $conpdl @$DIR/check_4_data.sql &`
wait
echo $checkdatapdl >> $LOG

if [$checkdatapdl = 1] ; then
  echo "EXISTEN DATOS" >> $LOG
else
  echo "No EXISTEN DATOS" >> $LOG
fi
0
Comment
Question by:opedrega
[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
3 Comments
 
LVL 16

Accepted Solution

by:
MohanKNair earned 2000 total points
ID: 16986508
Print the output from PL/SQL using DBMS_OUTPUT.PUT_LINE and redirect the output to a file.
From the shell script read the file.

sqlplus -s sqlplus -s $conpdl << EOF
set serveroutput on
var x number;

spool $DIR\outfile.dat
@$DIR/check_4_data.sql
spool off
exit;
EOF

cat $DIR\outfile.dat | while read line
do
checkdatapdl = $line
done;

if [$checkdatapdl = 1] ; then
  echo "EXISTEN DATOS" >> $LOG
else
  echo "No EXISTEN DATOS" >> $LOG
fi
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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…
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.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

597 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