exit unix after sqlerror in procedure
Hi!
Can anybody tell me, how it works to exit the UNIX Script after ANY SQLERROR has occured in my procedure??
my unix script executes a few procedures,
but how can i pass the error code to an unix variable and exit the unix script, if any oracle error occured?
PHP Code:
sqlplus -s <<EOF1
$usr/$pwd
set serveroutput on feedback off verify off heading off echo off
whenever sqlerror exit sql.sqlcode;
exec cqt_proc_cdr_insert;
exit;
EOF1`
now - just for testing - i got the error (when i run the script with the -x command - ORA-01536 space quota exceeded -
i got the errorcode on unix like 127,
I check the status, if there has any error occured within my procedure, it doesn't work.
PHP Code:
if [ $status -eq 0 ]; then
exit
echo "error code"
else
#go on within the unix script
..
..
fi
Because if there is any "ORACLE error", the script must exit and display an error message.
THANKS.