Can you give me an example ? I can't reproduce
[oracle@vbgeneric ~]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Jun 23 02:36:00 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> host cat /tmp/x.sql
whenever sqlerror exit sql.sqlcode
declare
e exception;
pragma exception_init(e,-12170);
begin
raise e;
end;
/
SQL> @/tmp/x.sql
declare
*
ERROR at line 1:
ORA-12170: TNS:Connect timeout occurred
ORA-06512: at line 5
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@vbgeneric ~]$ echo $?
138