Re: SQL.SQLCODE

From: Thomas J Kyte <tkyte_at_us.oracle.com>
Date: 1996/01/27
Message-ID: <4ec08u$7pn_at_inet-nntp-gw-1.us.oracle.com>#1/1


chuckh_at_ix.netcom.com (Chuck Hamilton) wrote:

>surman_at_oracle.com (Scott Urman) wrote:
 

>>In article <4eb456$2aq_at_cloner3.netcom.com>, chuckh_at_ix.netcom.com (Chuck Hamilton) writes:
>>|> Where do I find the list of error codes that get returned in
>>|> SQL.SQLCODE by SQLPLUS?
>>|>
>>|> example
>>|>
>>|> WHENEVER SQLERROR EXIT SQL.SQLCODE
>>|> --
>>|> Chuck Hamilton
>>|> chuckh_at_ix.netcom.com
>>|>
>>|> Never share a foxhole with anyone braver than yourself!
>>|>
>>There's an entire book of them, known as the 'Oracle7 Server Messages'. The
>>WHENEVER statement will cause SQL*Plus to exit if a SQL statement fails, and
>>return the Oracle error code to the operating system.
 

>But the ORACLE error reported while in SQLPLUS (ORA-????) is not the
>same as the error code returned by SQL.SQLCODE when it exits back to
>the shell. They're entirely different numbers. I need to find out what
>the SQL.SQLCODE error #'s mean.
>--
>Chuck Hamilton
>chuckh_at_ix.netcom.com
 

>If at first you don't succeed, sky-diving isn't for you.

Problem is UNIX, the following is from man -s 2 wait:  

          If the child process terminated due to an _exit() call,
          the  low  order 8 bits of status will be 0 and the high
          order 8 bits will contain the low order 8 bits  of  the
          argument  that the child process passed to _exit(); see
          exit(2).
 

Only an 8 bit number is ever returned from exit(n) to wait(pid). The sql.sqlcode is fairly meaningless (unmappable) to an oracle error code. For example: select * from XXX; results in ORA-942 which is 0x3AE, which if you strip off the high bits is 0xAE which is decimal 174, which is what the shell will report back to you (sql*plus exits with 942 however, the wait() command which is what you shell is using only gives you back the lower 8 bits).

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government Received on Sat Jan 27 1996 - 00:00:00 CET

Original text of this message