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

Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus exit code

Re: sqlplus exit code

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: 8 Jul 2003 22:33:57 -0700
Message-ID: <1a75df45.0307082133.9f8141e@posting.google.com>


"Justin" <e_fax_t_at_msn.ZAPME.com> wrote
>
> on unix I see that I can control the exit code sqlplus
> returns to the shell through the 'exit' command. Fine.
> Is there an easy way to pass on the integer return code
> of a pl/sql function as exit code, then?

Usage: { EXIT | QUIT } [ SUCCESS | FAILURE | WARNING | n |

       <variable> | :<bindvariable> ] [ COMMIT | ROLLBACK ]

Example:

SQL> variable exitcode number;
SQL>
SQL> begin

  2 select 23 into :exitcode from dual;   3 end;
  4 /

PL/SQL procedure successfully completed.

SQL> exit :exitcode

/home/oracle> echo $?
23

Just remember though that the exit code in Unix is not an int. exit() in stdlib.h is, but for some reason shells rerturns a max value of 255 (I think that's the low 8 bits only). Is this a kerbel issue btw - only have exit codes as a byte instead of a 2 byte int?

Would have been pretty nice to have the full ORA error code as the exit code (instead of having to grep and awk stdout).

--
Billy
Received on Wed Jul 09 2003 - 00:33:57 CDT

Original text of this message

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