Re: Oracle + Unix question , Error validation for SQL statements in co
process 2004-07-20 - By Daniel Fink
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 (See ORA-00942.ora-code.com): 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@(protected)
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
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
|
|