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

  • From: Daniel Fink <Daniel.Fink@xxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 20 Jul 2004 12:11:46 -0600

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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: