Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

why execution status of stored procedure in shell script is returning same?

871594Apr 27 2012 — edited Nov 6 2012
Hi Friends,

My shell script has below code to execute Pl/Sql procedure.depending on pl/sql procedure status i need to execute the script further.
i am testing error condition.So i kept exe instead of exec for executing procedure.it suppose to return non zero.But iam not getting the correct status in shell script using $?.
even for error condition also status is returning zero(0).How to catch execution status of stored procedure in shell script?

can you please me suggest whats is wrong in below code?


echo "*************************************************************"
echo " cleaning replica tables"
echo "*************************************************************"
sqlplus -s migrat/****@dotis01<<ENDOFSQL
WHENEVER SQLERROR EXIT 1;
exe PKG_OTU_HELPER.SP_CLEANUPREPLICA;
Commit;
exit;
ENDOFSQL
status=$?
echo $status // showing 0 always.
+if [ $status -ne 0 ]+
then
echo "issues in cleaning in replica tables"
exit;
fi
+#Loading of data from flat files to migration tables using sqlldr programs+
echo "*************************************************************"
echo " Loading of data from flat files to migration tables"
echo "*************************************************************"
sh /opt/finaclesoftware/UBS_10.4.02_AIX/AIX/DB/CRM/Oracle/OTU/Retail/ControlFiles/LoadData1.com

Thanks,
Venkat Vadlamudi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 4 2012
Added on Apr 27 2012
5 comments
988 views