Скрипт должен содержать что-то вроде этого:
whenever sqlerror exit rollback
Пример:
SQL> create table test (col number);
Table created.
SQL>
SQL-скрипт (с именем p.sql
)
whenever sqlerror exit rollback
insert into test values (100);
insert into test values ('A');
Вызов его:
M:\>sqlplus scott/tiger@orcl @p.sql
SQL*Plus: Release 11.2.0.1.0 Production on ╚et Ruj 26 13:38:50 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
1 row created.
insert into test values ('A')
*
ERROR at line 1:
ORA-01722: invalid number
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
M:\>
Результат:
SQL> select * From test;
no rows selected
SQL>