Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus exit code
"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
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).
-- BillyReceived on Wed Jul 09 2003 - 00:33:57 CDT
![]() |
![]() |