Jeg tror, at marionet opdager succesen af scriptet baseret på returkoden for det kaldte program. Som standard returnerer sqlplus 0, når du lukker det, uanset hvad der måtte være kørt under sessionen.
[[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
Hvis du vil have sqlplus til at afslutte med en fejlstatus, kan du bruge når kommandoen, f.eks.
[[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
Bemærk den anden returkode i sidstnævnte tilfælde. Dette burde være nok til at lade marionetten vide, at kommandoen mislykkedes.