Solved

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

Posted on 2006-06-26
3
370 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
3 Comments
 
LVL 16

Accepted Solution

by:
MohanKNair earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now