Solved

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

Posted on 2006-06-26
3
377 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.

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

831 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