Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How to get 'create or replace package' to indicate an error to SQL*Plus?
Hi all,
We have here a good-sized pile of PL/SQL packages, which we keep in files like this:
create or replace package body foo
is
procedure bar
is
begin
end;
end;
/
show errors;
-- snip --
Each file is named for the package it contains. To compile the package, one says "@foo" in SQL*Plus.
I'd like to be able to compile a file in the above format on the Unix command line and detect whether it has compiled correctly using the sqlplus' executable's return value. The following two ditties
> sqlplus -S userid/password <<EOF
whenever sqlerror exit failure
select sysdate from dual;
exit
EOF
> echo $?
0
> sqlplus -S userid/password <<EOF
whenever sqlerror exit failure
select sysdate from my butt;
exit
EOF
> echo $?
1
do what I expect, but this
> sqlplus -S userid/password <<EOF
whenever sqlerror exit failure
@foo
exit
EOF
(error message to the effect that the above package body has errors)
> echo $?
0
does not: it exits successfully, even though the package body has an error. (I used the package above, and the error is that the body is empty.)
Is there a way for me to get SQL*Plus to notice when a compilation fails and exit with an appropriate status?
Solaris 2.5, Oracle 7.3.2, SQL*Plus 3.3.2.
Thanks,
-- | Dave Schweisguth For purposes of complying with | | dcs_at_proton.chem.yale.edu (MIME OK) the New Jersey Right to Know Act: | | http://proton.chem.yale.edu/~dcs/ Contents partially unknown. | | Yale Depts. of MB&B & Chemistry Phone: 203-432-5208 Fax: 203-432-6144 |Received on Wed Feb 26 1997 - 00:00:00 CST
![]() |
![]() |