Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: exit status of sqlplus???

Re: exit status of sqlplus???

From: Jim Yoshii <yoshii_at_planet.net>
Date: 1997/02/19
Message-ID: <330B2BE7.280B@planet.net>#1/1

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.net
Received on Wed Feb 19 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US