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

From: Ubiquitous <>
Date: Fri, 19 Dec 2003 13:07:58 +0000 (UTC)
Message-ID: <brut7e$2dm$>

vishal <> 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 ]
echo "An error has occurred"

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

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

Original text of this message