Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to know in a unix script if oracle procedure executed or failed?

Re: How to know in a unix script if oracle procedure executed or failed?

From: Ubiquitous <weberm_at_polaris.net>
Date: Fri, 19 Dec 2003 13:07:58 +0000 (UTC)
Message-ID: <brut7e$2dm$1@news.utelfla.com>


vishal <c_vishal_at_hotmail.com> wrote:

: I am writing my first script to execute a Oracle procedure through a
: unix script. Could you tell me how do I do error handling here? How do
: I know in my script if the procedure executed successfully or failed?
: Thanks

What I do is run the script with the output piped to a log file and within the script itself, test for errors...
Within the stored procedure itself, there's a bunch of EXCEPTION handling clauses with more specific error messages.

$HOME/bin/qs "execute load_table('X')"
echo "load_table has executed"

if [ $? -ne 0 ]
then
echo "An error has occurred"
exit
fi

err=`grep 'ORA-' $HOME/logfile|wc -1
if [ $err -ne 0 ]
then
echo "An ORACLE error has occurred"
exit
fi

Hope this helps! Received on Fri Dec 19 2003 - 07:07:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US