Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: exit status of sqlplus???
Wang Chun wrote:
>
> Hi,
>
> I tried to run a sql script using sqlplus, however, I could not figure out
> how to check the exit status at the unix shell level of a certain sql script
> to see whether the sql script is successful or failure.
>
> for example:
>
> shell>sqlplus @my_sql_script
>
> ...
>
> shell> (as when sqlplus exits, it always give me the exit code 0)
>
> Any suggestion?
>
> Thanks in advance!
There are several options you can specify for the EXIT command:
EXIT FAILURE
EXIT SUCCESS
EXIT WARNING
EXIT n, where n is some integer value or variable
You can use this with WHENEVER SQLERROR:
WHENEVER SQLERROR EXIT FAILURE ROLLBACK This will cause your script to exit with an error code when an error occurs.
-- James H. Yoshii Intellitech Business Solutions yoshii_at_planet.netReceived on Wed Feb 19 1997 - 00:00:00 CST