Вярвам, че марионетката открива успеха на скрипта въз основа на кода за връщане на извиканата програма. По подразбиране sqlplus връща 0, когато го затворите, независимо какво може да е било изпълнено по време на сесията.
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 17 08:47:08 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select asdjkhasd from sadbjaksd;
select asdjkhasd from sadbjaksd
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[[email protected] ~]$ echo $?
0
Ако искате sqlplus да излезе със състояние на грешка, можете да използвате командата whenever, напр.
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 17 08:48:17 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> whenever sqlerror exit failure;
SQL> select bogus from nowhere;
select bogus from nowhere
*
ERROR at line 1:
ORA-00942: table or view does not exist
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[[email protected] ~]$ echo $?
1
Забележете различния код за връщане в последния случай. Това трябва да е достатъчно, за да уведоми марионетката, че командата е неуспешна.