Jag tror att marionett upptäcker framgången för skriptet baserat på returkoden för det anropade programmet. Som standard returnerar sqlplus 0 när du stänger den, oavsett vad som kan ha körts 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
Om du vill att sqlplus ska avslutas med en felstatus kan du använda när-kommandot, t.ex.
[[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
Lägg märke till den andra returkoden i det senare fallet. Detta borde vara tillräckligt för att dockan ska veta att kommandot misslyckades.