I use "WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK;" in my plsql scripts to use them in shell scripts. This works fine:
echo exit | sqlplus user/pass@XE @normal.sql && echo "boo"
Executes the script and prints "boo" This works fine too:
echo exit | sqlplus user/pass@XE @bad.sql && echo "boo"
"boo" is not printed.
However in case bad is:
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK;
create or replace
PACKAGE TESTING
IS
function boo (co_id number) return varchar2;
END;
/
create or replace
PACKAGE BODY TESTING
is
end;
Which is obviously wrong - no error code is returned and "boo" is printed. How can I return plsqsl compilation error codes from sqlplus scripts?