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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Oracle + Unix question , Error validation for SQL statements in co process ?.

Re: Oracle + Unix question , Error validation for SQL statements in co process ?.

From: Daniel Fink <Daniel.Fink_at_Sun.COM>
Date: Tue, 20 Jul 2004 12:11:46 -0600
Message-id: <40FD6062.6070505@sun.com>


Inline

Kevin Lange wrote:

> The thing is, the ?$ will not give you anthing but a 0 when you use it after
> the SQL statement because SQLPLUS finish correctly ... even if the SQL that
> is ran does not.   i.e.   The RC of SQLPLUS will always be 0 unless SQLPLUS
> itself fails.

I must disagree. You can return a numeric value from 0 to 255 (?) from a sql*plus session. If you return a number larger than 255, it is the modulus of value/256.

$ echo $?

0
$ sqlplus "/ as sysdba"

SQL> exit 1

$ echo $?

1
$ sqlplus "/ as sysdba"

SQL> whenever sqlerror exit 1
SQL> select * from alskjfajafls;
select * from alskjfajafls

               *
ERROR at line 1:
ORA-00942: table or view does not exist

$ echo $?

1
$ sqlplus "/ as sysdba"

SQL> exit 254

$ echo $?

254
$ sqlplus "/ as sysdba"

SQL> exit 255

$ echo $?

255
$ sqlplus "/ as sysdba"

SQL> exit 256

$ echo $?

0
$ sqlplus "/ as sysdba"

SQL> exit 257

$ echo $?

1
$



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Tue Jul 20 2004 - 13:09:19 CDT

Original text of this message

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