Re: sqlplus return codes on unix
From: Allen Kirby <akirby_at_att.com>
Date: 1997/01/02
Message-ID: <32CBFC94.67AE_at_att.com>#1/1
Date: 1997/01/02
Message-ID: <32CBFC94.67AE_at_att.com>#1/1
Chuck Hamilton wrote:
>
> Is there a way to get the full return code from SQLPLUS back to a unix
> shell script? Unix only looks at the low-order byte. Is there perhaps
> a specific shell that'll get a two byte return code?
> --
> Chuck Hamilton
> chuckh_at_dvol.com
>
> This message delivered by electronic sled dogs. WOOF!
Chuck,
The problem is not in the shell. The kernel only reserves 2 bytes (unsigned short) to the exit status. However, there are three cases where the wait system call will return the exit status: Process terminated due to signal - low order 8 bits contain the signal value and high order 8 bits contain 0. Process stopped - low order 8 bits contain WSTOPFLG and high order 8 bits contain the signal that caused it to stop. Process terminated from _exit() call: low order 8 bits contain 0 and high order 8 bits contain low order 8 bits from the value passed to exit() by the child program. Because the exit status contains more than just an exit value, only the low order 8 bits are passed to the parent. This came from Solaris 2.3 man page for wait(2). You'll have to store the return code externally - in a table or file - then retrieve it in the parent shell if you want to get the exact error number. Or rewrite the sqlplus program in Pro*C and have direct access to the return code.
Good Luck.
-- --- Allen Kirby AT&T ITS Production Services akirby_at_att.com Alpharetta, GA.Received on Thu Jan 02 1997 - 00:00:00 CET