Tag: SQLERROR

How to terminate and rollback a SQL script when running in SQL*Plus when an error is encountered?

Adding the following line before running a SQL Script will terminate the SQL script from running and rollback the change when an error is encountered. WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK; Example: SQL> select * FROM test; no rows selected SQL> WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK; SQL> insert into test values ( 1 ); 1 row … Continue reading How to terminate and rollback a SQL script when running in SQL*Plus when an error is encountered?