I have a third question regarding this process.
I have a database procedure that will produce an error.
The procedure is
PROCEDURE test_error IS
BEGIN
raise NO_DATA_FOUND;
END;
This is how I call sqlplus from the unix script
sqlplus -s username/password <<eof
whenever SQLERROR exit 2
whenever OSERROR exit 3
exec database_utils.test_error
eof
ERRORCODE=$?
echo $ERRORCODE
In this case the ERRORCODE is 3
If I change the code to this
sqlplus -s username/password <<eof
whenever OSERROR exit 3
whenever SQLERROR exit 2
exec database_utils.test_error
eof
ERRORCODE=$?
echo $ERRORCODE
the ERRORCODE is 2.
It seems that the whenever statement is not reacting prolerly. It always takes the exit statement from the last whenever code. Is there something wrong with my script?
I am using Oracle 10g and AIX for the shell scripting.
Thank you in advance